You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2008/01/07 00:01:04 UTC

svn commit: r609460 - in /tomcat: container/tc5.5.x/catalina/src/share/org/apache/catalina/connector/CoyoteAdapter.java container/tc5.5.x/webapps/docs/changelog.xml current/tc5.5.x/STATUS.txt

Author: markt
Date: Sun Jan  6 15:01:02 2008
New Revision: 609460

URL: http://svn.apache.org/viewvc?rev=609460&view=rev
Log:
Fix bug 43914. Location headers must be encoded. Patch provided by Ivan Todoroski.

Modified:
    tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/connector/CoyoteAdapter.java
    tomcat/container/tc5.5.x/webapps/docs/changelog.xml
    tomcat/current/tc5.5.x/STATUS.txt

Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/connector/CoyoteAdapter.java
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/connector/CoyoteAdapter.java?rev=609460&r1=609459&r2=609460&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/connector/CoyoteAdapter.java (original)
+++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/connector/CoyoteAdapter.java Sun Jan  6 15:01:02 2008
@@ -24,6 +24,7 @@
 import org.apache.catalina.Globals;
 import org.apache.catalina.Wrapper;
 import org.apache.catalina.util.StringManager;
+import org.apache.catalina.util.URLEncoder;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.coyote.ActionCode;
@@ -103,6 +104,28 @@
         StringManager.getManager(Constants.Package);
 
 
+    /**
+     * Encoder for the Location URL in HTTP redirects.
+     */
+    protected static URLEncoder urlEncoder;
+
+
+    // ----------------------------------------------------- Static Initializer
+
+
+    /**
+     * The safe character set.
+     */
+    static {
+        urlEncoder = new URLEncoder();
+        urlEncoder.addSafeCharacter('-');
+        urlEncoder.addSafeCharacter('_');
+        urlEncoder.addSafeCharacter('.');
+        urlEncoder.addSafeCharacter('*');
+        urlEncoder.addSafeCharacter('/');
+    }
+
+
     // -------------------------------------------------------- Adapter Methods
 
 
@@ -311,7 +334,7 @@
         // Possible redirect
         MessageBytes redirectPathMB = request.getMappingData().redirectPath;
         if (!redirectPathMB.isNull()) {
-            String redirectPath = redirectPathMB.toString();
+            String redirectPath = urlEncoder.encode(redirectPathMB.toString());
             String query = request.getQueryString();
             if (request.isRequestedSessionIdFromURL()) {
                 // This is not optimal, but as this is not very common, it

Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?rev=609460&r1=609459&r2=609460&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Sun Jan  6 15:01:02 2008
@@ -105,6 +105,10 @@
         <bug>43887</bug>: Include exception in the log message. (markt)
       </fix>
       <fix>
+        <bug>43914</bug>: Location headers must be encoded. Patch provided by
+        Ivan Todoroski. (markt)
+      </fix>
+      <fix>
         <bug>43957</bug>: Service.bat didn't configure logging correctly.
         Patch provided by Richard Fearn. (markt)
       </fix>

Modified: tomcat/current/tc5.5.x/STATUS.txt
URL: http://svn.apache.org/viewvc/tomcat/current/tc5.5.x/STATUS.txt?rev=609460&r1=609459&r2=609460&view=diff
==============================================================================
--- tomcat/current/tc5.5.x/STATUS.txt (original)
+++ tomcat/current/tc5.5.x/STATUS.txt Sun Jan  6 15:01:02 2008
@@ -47,12 +47,6 @@
   -1:
    0: fhanik, this needs to be reworked completely, so I'm neutral
 
-* Fix http://issues.apache.org/bugzilla/show_bug.cgi?id=43914
-  Location headers must be encoded. Patch provided by Ivan Todoroski.
-  http://svn.apache.org/viewvc?rev=606952&view=rev
-  +1: markt, pero, fhanik
-  -1: 
-
 * Fix http://issues.apache.org/bugzilla/show_bug.cgi?id=43839
   URL based session tracking fails when session cookie from parent context is
   present. Based on a patch by Yuan Qingyun.



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