[Zope-Checkins] CVS: Packages/ZPublisher/tests -
testHTTPRequest.py:1.10.2.1
Florent Guillaume
fg at nuxeo.com
Fri Nov 26 13:45:51 EST 2004
Update of /cvs-repository/Packages/ZPublisher/tests
In directory cvs.zope.org:/tmp/cvs-serv30896/lib/python/ZPublisher/tests
Modified Files:
Tag: Zope-2_7-branch
testHTTPRequest.py
Log Message:
Collector #1498: Don't choke on malformed cookies. Cookies of the form
"foo=bar; hmm; baz=gee" will give an empty value for 'hmm' instead of
silently discarding it and the rest of the string. (Thanks to 'sirilyan'
for the patch.)
=== Packages/ZPublisher/tests/testHTTPRequest.py 1.10 => 1.10.2.1 ===
--- Packages/ZPublisher/tests/testHTTPRequest.py:1.10 Wed Apr 9 16:26:22 2003
+++ Packages/ZPublisher/tests/testHTTPRequest.py Fri Nov 26 13:45:50 2004
@@ -564,6 +564,25 @@
self._noTaintedValues(req)
self._onlyTaintedformHoldsTaintedStrings(req)
+ def testCookieParsing(self):
+ env = {'SERVER_NAME': 'testingharnas', 'SERVER_PORT': '80'}
+
+ env['HTTP_COOKIE'] = 'foo=bar; baz=gee'
+ req = self._getHTTPRequest(env)
+ self.assertEquals(req.cookies['foo'], 'bar')
+ self.assertEquals(req.cookies['baz'], 'gee')
+
+ env['HTTP_COOKIE'] = 'foo=bar; baz="gee, like, e=mc^2"'
+ req = self._getHTTPRequest(env)
+ self.assertEquals(req.cookies['foo'], 'bar')
+ self.assertEquals(req.cookies['baz'], 'gee, like, e=mc^2')
+
+ # Collector #1498: empty cookies
+ env['HTTP_COOKIE'] = 'foo=bar; hmm; baz=gee'
+ req = self._getHTTPRequest(env)
+ self.assertEquals(req.cookies['foo'], 'bar')
+ self.assertEquals(req.cookies['hmm'], '')
+ self.assertEquals(req.cookies['baz'], 'gee')
TEST_ENVIRON = {
'CONTENT_TYPE': 'multipart/form-data; boundary=12345',
More information about the Zope-Checkins
mailing list