]> granicus.if.org Git - python/commitdiff
Patch #103473 from dougfort: Some sites (amazon.com for one) drop
authorAndrew M. Kuchling <amk@amk.ca>
Tue, 20 Feb 2001 22:11:24 +0000 (22:11 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Tue, 20 Feb 2001 22:11:24 +0000 (22:11 +0000)
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 '='.

Lib/Cookie.py

index 565e6f3fb498ba04338e22793d6b75d323bfa452..f4d73e6fabcd98f955d3709ca8fcdd4af4a29766 100644 (file)
@@ -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<key>"                   # 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<val>"                   # Start of group 'val'