summaryrefslogtreecommitdiff
path: root/Lib/test
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-05-22 11:29:19 +0000
committerGeorg Brandl <georg@python.org>2010-05-22 11:29:19 +0000
commit5d0ca2c8323b39e392c0c0bd31340cc3e1113c97 (patch)
tree1601fff6f5da3b4163e13c562a6e7a1e99280302 /Lib/test
parentf93ce0c1f53bf8507eb970b7113c93994ce682a0 (diff)
downloadcpython-git-5d0ca2c8323b39e392c0c0bd31340cc3e1113c97.tar.gz
Issue #3924: Ignore cookies with invalid "version" field in cookielib.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_cookielib.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/Lib/test/test_cookielib.py b/Lib/test/test_cookielib.py
index b75511ce47..f57e0c7279 100644
--- a/Lib/test/test_cookielib.py
+++ b/Lib/test/test_cookielib.py
@@ -99,7 +99,8 @@ class DateTimeTests(TestCase):
class HeaderTests(TestCase):
- def test_parse_ns_headers(self):
+
+ def test_parse_ns_headers_expires(self):
from cookielib import parse_ns_headers
# quotes should be stripped
@@ -110,6 +111,17 @@ class HeaderTests(TestCase):
]:
self.assertEquals(parse_ns_headers([hdr]), expected)
+ def test_parse_ns_headers_version(self):
+ from cookielib import parse_ns_headers
+
+ # quotes should be stripped
+ expected = [[('foo', 'bar'), ('version', '1')]]
+ for hdr in [
+ 'foo=bar; version="1"',
+ 'foo=bar; Version="1"',
+ ]:
+ self.assertEquals(parse_ns_headers([hdr]), expected)
+
def test_parse_ns_headers_special_names(self):
# names such as 'expires' are not special in first name=value pair
# of Set-Cookie: header
@@ -1091,6 +1103,8 @@ class CookieTests(TestCase):
["Set-Cookie2: a=foo; path=/; Version=1; domain"],
# bad max-age
["Set-Cookie: b=foo; max-age=oops"],
+ # bad version
+ ["Set-Cookie: b=foo; version=spam"],
]:
c = cookiejar_from_cookie_headers(headers)
# these bad cookies shouldn't be set