summaryrefslogtreecommitdiffstats
path: root/Lib/http
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2015-05-23 15:41:30 (GMT)
committerBenjamin Peterson <benjamin@python.org>2015-05-23 15:41:30 (GMT)
commit5a69420062b3d85bbe7c434e81f54f4a4e1f0e2d (patch)
tree23238e5f32b9c68c3e7f4d5acda0970732083cda /Lib/http
parenta48db2bc8b882e887fbe8a84b31828d8491dd877 (diff)
parentc4ae86e47730a4466a8d6ebae4c5531bf1dfca3b (diff)
downloadcpython-5a69420062b3d85bbe7c434e81f54f4a4e1f0e2d.zip
cpython-5a69420062b3d85bbe7c434e81f54f4a4e1f0e2d.tar.gz
cpython-5a69420062b3d85bbe7c434e81f54f4a4e1f0e2d.tar.bz2
merge 3.4 (#22931)
Diffstat (limited to 'Lib/http')
-rw-r--r--Lib/http/cookies.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/http/cookies.py b/Lib/http/cookies.py
index 26c9ac4..fda02b7 100644
--- a/Lib/http/cookies.py
+++ b/Lib/http/cookies.py
@@ -455,12 +455,13 @@ class Morsel(dict):
# result, the parsing rules here are less strict.
#
-_LegalCharsPatt = r"[\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=]"
+_LegalKeyChars = r"\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\="
+_LegalValueChars = _LegalKeyChars + '\[\]'
_CookiePattern = re.compile(r"""
(?x) # This is a verbose pattern
\s* # Optional whitespace at start of cookie
(?P<key> # Start of group 'key'
- """ + _LegalCharsPatt + r"""+? # Any word of at least one letter
+ [""" + _LegalKeyChars + r"""]+? # Any word of at least one letter
) # End of group 'key'
( # Optional group: there may not be a value.
\s*=\s* # Equal Sign
@@ -469,7 +470,7 @@ _CookiePattern = re.compile(r"""
| # or
\w{3},\s[\w\d\s-]{9,11}\s[\d:]{8}\sGMT # Special case for "expires" attr
| # or
- """ + _LegalCharsPatt + r"""* # Any word or empty string
+ [""" + _LegalValueChars + r"""]* # Any word or empty string
) # End of group 'val'
)? # End of optional value group
\s* # Any number of spaces.