From: Andrew M. Kuchling Date: Tue, 20 Feb 2001 22:11:24 +0000 (+0000) Subject: Patch #103473 from dougfort: Some sites (amazon.com for one) drop X-Git-Tag: v2.1b1~255 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c05abb3bdaa87b6e5ea2d6db1e5d6145ae2b0440;p=python Patch #103473 from dougfort: Some sites (amazon.com for one) drop cookies that contain '=' as part of the value. This patch modifies Cookie.py to allow '=' as a legal character, and to make the key search nongreedy so it stops at the first '='. --- diff --git a/Lib/Cookie.py b/Lib/Cookie.py index 565e6f3fb4..f4d73e6fab 100644 --- a/Lib/Cookie.py +++ b/Lib/Cookie.py @@ -521,11 +521,11 @@ class Morsel(UserDict): # result, the parsing rules here are less strict. # -_LegalCharsPatt = r"[\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{]" +_LegalCharsPatt = r"[\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=]" _CookiePattern = re.compile( r"(?x)" # This is a Verbose pattern r"(?P" # Start of group 'key' - ""+ _LegalCharsPatt +"+" # Any word of at least one letter + ""+ _LegalCharsPatt +"+?" # Any word of at least one letter, nongreedy r")" # End of group 'key' r"\s*=\s*" # Equal Sign r"(?P" # Start of group 'val'