[issue35824] http.cookies._CookiePattern modifying regular expressions
Martin Panter
report at bugs.python.org
Thu Apr 25 06:09:58 EDT 2019
Martin Panter <vadmium+py at gmail.com> added the comment:
Test_http_cookies line 19 has the following test case:
{'data': 'keebler="E=mc2; L=\\"Loves\\"; fudge=\\012;"',
'dict': {'keebler' : 'E=mc2; L="Loves"; fudge=\012;'},
'repr': '''<SimpleCookie: keebler='E=mc2; L="Loves"; fudge=\\n;'>''',
'output': 'Set-Cookie: keebler="E=mc2; L=\\"Loves\\"; fudge=\\012;"'}
This is similar to an example in the documentation:
>>> C.load('keebler="E=everybody; L=\\"Loves\\"; fudge=\\012;";')
>>> print(C)
Set-Cookie: keebler="E=everybody; L=\"Loves\"; fudge=\012;"
If you break parsing of this string in the “load” method, you break documented behaviour. The “http.cookie” module is documented to follow RFC 2109. I believe the strings are valid by RFC 2109, in which the value is allowed to use the HTTP “quoted-string” format.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35824>
_______________________________________
More information about the Python-bugs-list
mailing list