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

Lennart Regebro regebro at gmail.com
Sun Jul 1 10:27:05 EDT 2007


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

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

-=-
Modified: Zope/branches/2.10/doc/CHANGES.txt
===================================================================
--- Zope/branches/2.10/doc/CHANGES.txt	2007-07-01 13:41:59 UTC (rev 77282)
+++ Zope/branches/2.10/doc/CHANGES.txt	2007-07-01 14:27:04 UTC (rev 77283)
@@ -8,6 +8,8 @@
 
     Bugs fixed
 
+      - Collector #2153: Supporting unquoted cookies with spaces.
+
       - The REQUEST no longer accepts holds after it has been closed.
 
       - Collector #1441: WebDAV compatibility with Windows Web Folders

Modified: Zope/branches/2.10/lib/python/ZPublisher/HTTPRequest.py
===================================================================
--- Zope/branches/2.10/lib/python/ZPublisher/HTTPRequest.py	2007-07-01 13:41:59 UTC (rev 77282)
+++ Zope/branches/2.10/lib/python/ZPublisher/HTTPRequest.py	2007-07-01 14:27:04 UTC (rev 77283)
@@ -1471,7 +1471,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/branches/2.10/lib/python/ZPublisher/tests/testHTTPRequest.py
===================================================================
--- Zope/branches/2.10/lib/python/ZPublisher/tests/testHTTPRequest.py	2007-07-01 13:41:59 UTC (rev 77282)
+++ Zope/branches/2.10/lib/python/ZPublisher/tests/testHTTPRequest.py	2007-07-01 14:27:04 UTC (rev 77283)
@@ -649,6 +649,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