Author: markt
Date: Thu Aug  4 18:47:41 2016
New Revision: 1755224

URL: http://svn.apache.org/viewvc?rev=1755224&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=59888
Correctly handle tabs and spaces in quoted version one cookies when using the 
Rfc6265CookieProcessor.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/http/parser/Cookie.java
    tomcat/trunk/test/org/apache/tomcat/util/http/TestCookieParsing.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/tomcat/util/http/parser/Cookie.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/parser/Cookie.java?rev=1755224&r1=1755223&r2=1755224&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/http/parser/Cookie.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/http/parser/Cookie.java Thu Aug  4 
18:47:41 2016
@@ -86,7 +86,7 @@ public class Cookie {
             }
         }
         for (int i = 0; i < 256; i++) {
-            if (i < 0x21 || i == DEL_BYTE) {
+            if (i < TAB_BYTE || (i > TAB_BYTE && i < SPACE_BYTE) || i == 
DEL_BYTE) {
                 isText[i] = false;
             } else {
                 isText[i] = true;

Modified: tomcat/trunk/test/org/apache/tomcat/util/http/TestCookieParsing.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/http/TestCookieParsing.java?rev=1755224&r1=1755223&r2=1755224&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/util/http/TestCookieParsing.java 
(original)
+++ tomcat/trunk/test/org/apache/tomcat/util/http/TestCookieParsing.java Thu 
Aug  4 18:47:41 2016
@@ -51,6 +51,12 @@ public class TestCookieParsing extends T
     private static final String[] COOKIES_WITH_QUOTES = new String[] {
             "name=\"val\\\"ue\"", "name=\"value\"" };
 
+    private static final String[] COOKIES_V1 = new String[] {
+            "$Version=1;name=\"val ue\"", "$Version=1;name=\"val\tue\""};
+
+    private static final String COOKIES_V1_CONCAT = "name=\"val 
ue\"name=\"val\tue\"";
+
+
     @Test
     public void testLegacyWithEquals() throws Exception {
         doTestLegacyEquals(true);
@@ -130,6 +136,14 @@ public class TestCookieParsing extends T
 
 
     @Test
+    public void testRfc6265V1() throws Exception {
+        TestCookieParsingClient client = new TestCookieParsingClient(
+                new Rfc6265CookieProcessor(), COOKIES_V1, COOKIES_V1_CONCAT);
+        client.doRequest();
+    }
+
+
+    @Test
     public void testLegacyWithSeps() throws Exception {
         doTestLegacySeps(true, true);
     }
@@ -296,8 +310,6 @@ public class TestCookieParsing extends T
     }
 
 
-
-
     private static class EchoCookieHeader extends HttpServlet {
 
         private static final long serialVersionUID = 1L;

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1755224&r1=1755223&r2=1755224&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Thu Aug  4 18:47:41 2016
@@ -102,6 +102,10 @@
         <code>WEB-INF/classes/META-INF</code> (if present) since classes will
         never be loaded from that location. (markt)
       </fix>
+      <fix>
+        <bug>59888</bug>: Correctly handle tabs and spaces in quoted version 
one
+        cookies when using the <code>Rfc6265CookieProcessor</code>. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">



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

Reply via email to