Author: markt
Date: Tue Feb 15 17:57:21 2011
New Revision: 1070987

URL: http://svn.apache.org/viewvc?rev=1070987&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50734
Return 404 rather than 400 for requests to / when no ROOT context is deployed
https://issues.apache.org/bugzilla/attachment.cgi?id=26626

Modified:
    tomcat/tc6.0.x/trunk/STATUS.txt
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1070987&r1=1070986&r2=1070987&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Tue Feb 15 17:57:21 2011
@@ -103,13 +103,6 @@ PATCHES PROPOSED TO BACKPORT:
   +1: markt, kkolinko
   -1:
 
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50734
-  Return 404 rather than 400 for requests to / when no ROOT context is deployed
-  https://issues.apache.org/bugzilla/attachment.cgi?id=26626
-  Patch provided by Violeta Georgieva
-  +1: markt, kfujino, kkolinko
-  -1:
-
 * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50726
   Ensure that the use of the genStringAsCharArray does not result in String
   constants that are too long for valid Java code.

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java?rev=1070987&r1=1070986&r2=1070987&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java 
Tue Feb 15 17:57:21 2011
@@ -507,6 +507,15 @@ public class CoyoteAdapter implements Ad
                                   request.getMappingData());
         request.setContext((Context) request.getMappingData().context);
         
+        // If there is no context at this point, it is likely no ROOT context
+        // has been deployed
+        if (request.getContext() == null) {
+            res.setStatus(404);
+            res.setMessage("Not found");
+            connector.getService().getContainer().logAccess(request, response, 
0, true);
+            return false;
+        }
+        
         // Had to do this after the context was set.
         // Unfortunately parseSessionId is still necessary as it 
         // affects the final URL. Safe as session cookies still 

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=1070987&r1=1070986&r2=1070987&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Tue Feb 15 17:57:21 2011
@@ -47,6 +47,11 @@
   <subsection name="Catalina">
     <changelog>
       <fix>
+        <bug>50734</bug>: Return 404 rather than 400 for requests to the ROOT
+        context when no ROOT context is deployed. Patch provided by Violeta
+        Georgieva. (markt)
+      </fix>
+      <fix>
         <bug>50752</bug>: Fix typo in debug message in
         <code>org.apache.catalina.startup.Embedded</code>. (markt)
       </fix>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to