summaryrefslogtreecommitdiffstats
path: root/Lib/http
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2015-05-23 15:38:48 (GMT)
committerBenjamin Peterson <benjamin@python.org>2015-05-23 15:38:48 (GMT)
commitd504f20e1c30d7ee328e897e1bb93cba3d1db7a2 (patch)
tree2fbb319282a937ba1bb3d6c332237006f057060f /Lib/http
parentdeff2b76ec3824ff238ad0812c29aca95534ecb4 (diff)
parent9bd476ea57e1f77c5d117577d721bff806137a09 (diff)
downloadcpython-d504f20e1c30d7ee328e897e1bb93cba3d1db7a2.zip
cpython-d504f20e1c30d7ee328e897e1bb93cba3d1db7a2.tar.gz
cpython-d504f20e1c30d7ee328e897e1bb93cba3d1db7a2.tar.bz2
merge 3.2 (#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 556d101..00082a6 100644
--- a/Lib/http/cookies.py
+++ b/Lib/http/cookies.py
@@ -428,12 +428,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
@@ -442,7 +443,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.