Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c05abb3

Browse files
committed
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 '='.
1 parent 85cd1d6 commit c05abb3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Lib/Cookie.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,11 +521,11 @@ def OutputString(self, attrs=None):
521521
# result, the parsing rules here are less strict.
522522
#
523523

524-
_LegalCharsPatt = r"[\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{]"
524+
_LegalCharsPatt = r"[\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=]"
525525
_CookiePattern = re.compile(
526526
r"(?x)" # This is a Verbose pattern
527527
r"(?P<key>" # Start of group 'key'
528-
""+ _LegalCharsPatt +"+" # Any word of at least one letter
528+
""+ _LegalCharsPatt +"+?" # Any word of at least one letter, nongreedy
529529
r")" # End of group 'key'
530530
r"\s*=\s*" # Equal Sign
531531
r"(?P<val>" # Start of group 'val'

0 commit comments

Comments
 (0)