Commit d130a1bc authored by Lennart Regebro's avatar Lennart Regebro

Collector #2153: Supporting unquoted cookies with spaces.

parent b9679862
...@@ -102,6 +102,8 @@ Zope Changes ...@@ -102,6 +102,8 @@ Zope Changes
Bugs Fixed Bugs Fixed
- Collector #2153: Supporting unquoted cookies with spaces.
- The REQUEST no longer accepts holds after it has been closed. - The REQUEST no longer accepts holds after it has been closed.
- Five.browser.metaconfigure.page didn't protect names from interface - Five.browser.metaconfigure.page didn't protect names from interface
......
...@@ -1476,7 +1476,7 @@ def parse_cookie(text, ...@@ -1476,7 +1476,7 @@ def parse_cookie(text,
qparmre=re.compile( qparmre=re.compile(
'([\x00- ]*([^\x00- ;,="]+)="([^"]*)"([\x00- ]*[;,])?[\x00- ]*)'), '([\x00- ]*([^\x00- ;,="]+)="([^"]*)"([\x00- ]*[;,])?[\x00- ]*)'),
parmre=re.compile( parmre=re.compile(
'([\x00- ]*([^\x00- ;,="]+)=([^\x00- ;,"]*)([\x00- ]*[;,])?[\x00- ]*)'), '([\x00- ]*([^\x00- ;,="]+)=([^;,"]*)([\x00- ]*[;,])?[\x00- ]*)'),
paramlessre=re.compile( paramlessre=re.compile(
'([\x00- ]*([^\x00- ;,="]+)[\x00- ]*[;,][\x00- ]*)'), '([\x00- ]*([^\x00- ;,="]+)[\x00- ]*[;,][\x00- ]*)'),
......
...@@ -658,6 +658,20 @@ class ProcessInputsTests(unittest.TestCase): ...@@ -658,6 +658,20 @@ class ProcessInputsTests(unittest.TestCase):
self.assertEquals(req.cookies['hmm'], '') self.assertEquals(req.cookies['hmm'], '')
self.assertEquals(req.cookies['baz'], 'gee') 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 = { TEST_ENVIRON = {
'CONTENT_TYPE': 'multipart/form-data; boundary=12345', 'CONTENT_TYPE': 'multipart/form-data; boundary=12345',
'REQUEST_METHOD': 'POST', 'REQUEST_METHOD': 'POST',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment