(original) (raw)
changeset: 76457:57ec2e6cd70a parent: 76454:0356103cde28 user: Senthil Kumaran senthil@uthcode.com date: Sun Apr 22 09:19:04 2012 +0800 files: Lib/http/cookies.py Lib/test/test_http_cookies.py Misc/NEWS description: Fix Issue2193 - Allow ":" character in Cookie NAME values diff -r 0356103cde28 -r 57ec2e6cd70a Lib/http/cookies.py --- a/Lib/http/cookies.py Sat Apr 21 19:11:58 2012 -0400 +++ b/Lib/http/cookies.py Sun Apr 22 09:19:04 2012 +0800 @@ -159,7 +159,7 @@ # _LegalChars is the list of chars which don't require "'s # _Translator hash-table for fast quoting # -_LegalChars = string.ascii_letters + string.digits + "!#$%&'*+-.^_`|~" +_LegalChars = string.ascii_letters + string.digits + "!#$%&'*+-.^_`|~:" _Translator = { '\000' : '\\000', '\001' : '\\001', '\002' : '\\002', '\003' : '\\003', '\004' : '\\004', '\005' : '\\005', diff -r 0356103cde28 -r 57ec2e6cd70a Lib/test/test_http_cookies.py --- a/Lib/test/test_http_cookies.py Sat Apr 21 19:11:58 2012 -0400 +++ b/Lib/test/test_http_cookies.py Sun Apr 22 09:19:04 2012 +0800 @@ -34,6 +34,15 @@ 'dict': {'keebler' : 'E=mc2'}, 'repr': "", 'output': 'Set-Cookie: keebler=E=mc2'}, + + # Cookies with ':' character in their name. Though not mentioned in + # RFC, servers / browsers allow it. + + {'data': 'key:term=value:term', + 'dict': {'key:term' : 'value:term'}, + 'repr': "", + 'output': 'Set-Cookie: key:term=value:term'}, + ] for case in cases: diff -r 0356103cde28 -r 57ec2e6cd70a Misc/NEWS --- a/Misc/NEWS Sat Apr 21 19:11:58 2012 -0400 +++ b/Misc/NEWS Sun Apr 22 09:19:04 2012 +0800 @@ -61,6 +61,8 @@ Library ------- +- Issue #2193: Allow ":" character in Cookie NAME values. + - Issue #14629: tokenizer.detect_encoding will specify the filename in the SyntaxError exception if found at readline.__self__.name./senthil@uthcode.com