[Zope-Checkins] SVN: Zope/trunk/ Collector #2153: Supporting unquoted cookies with spaces.

Lennart Regebro regebro at gmail.com
Sun Jul 1 09:32:19 EDT 2007


Log message for revision 77281:
  Collector #2153: Supporting unquoted cookies with spaces.
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/ZPublisher/HTTPRequest.py
  U   Zope/trunk/lib/python/ZPublisher/tests/testHTTPRequest.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt	2007-07-01 13:23:27 UTC (rev 77280)
+++ Zope/trunk/doc/CHANGES.txt	2007-07-01 13:32:18 UTC (rev 77281)
@@ -102,6 +102,8 @@
 
     Bugs Fixed
 
+      - Collector #2153: Supporting unquoted cookies with spaces.
+
       - The REQUEST no longer accepts holds after it has been closed.
 
       - Five.browser.metaconfigure.page didn't protect names from interface

Modified: Zope/trunk/lib/python/ZPublisher/HTTPRequest.py
===================================================================
--- Zope/trunk/lib/python/ZPublisher/HTTPRequest.py	2007-07-01 13:23:27 UTC (rev 77280)
+++ Zope/trunk/lib/python/ZPublisher/HTTPRequest.py	2007-07-01 13:32:18 UTC (rev 77281)
@@ -1476,7 +1476,7 @@
                  qparmre=re.compile(
                     '([\x00- ]*([^\x00- ;,="]+)="([^"]*)"([\x00- ]*[;,])?[\x00- ]*)'),
                  parmre=re.compile(
-                    '([\x00- ]*([^\x00- ;,="]+)=([^\x00- ;,"]*)([\x00- ]*[;,])?[\x00- ]*)'),
+                    '([\x00- ]*([^\x00- ;,="]+)=([^;,"]*)([\x00- ]*[;,])?[\x00- ]*)'),
                  paramlessre=re.compile(
                     '([\x00- ]*([^\x00- ;,="]+)[\x00- ]*[;,][\x00- ]*)'),
 

Modified: Zope/trunk/lib/python/ZPublisher/tests/testHTTPRequest.py
===================================================================
--- Zope/trunk/lib/python/ZPublisher/tests/testHTTPRequest.py	2007-07-01 13:23:27 UTC (rev 77280)
+++ Zope/trunk/lib/python/ZPublisher/tests/testHTTPRequest.py	2007-07-01 13:32:18 UTC (rev 77281)
@@ -658,6 +658,20 @@
         self.assertEquals(req.cookies['hmm'], '')
         self.assertEquals(req.cookies['baz'], 'gee')
 
+	# Unquoted multi-space cookies
+        env['HTTP_COOKIE'] = 'single=cookie data; ' \
+	                     'quoted="cookie data with unquoted spaces"; ' \
+			     'multi=cookie data with unquoted spaces; ' \
+			     'multi2=cookie data with unquoted spaces'
+        req = self._getHTTPRequest(env)
+        self.assertEquals(req.cookies['single'], 'cookie data')
+        self.assertEquals(req.cookies['quoted'], 
+	                              'cookie data with unquoted spaces')
+        self.assertEquals(req.cookies['multi'], 
+	                              'cookie data with unquoted spaces')
+        self.assertEquals(req.cookies['multi2'], 
+	                              'cookie data with unquoted spaces')
+
 TEST_ENVIRON = {
     'CONTENT_TYPE': 'multipart/form-data; boundary=12345',
     'REQUEST_METHOD': 'POST',



More information about the Zope-Checkins mailing list