Berker Peksag <[email protected]> added the comment:
>>> from http.cookies import SimpleCookie
>>> c = SimpleCookie()
>>> c['name'] = 'value'
>>> c['name']['comment'] = '\n'
>>> c['name']['expires'] = '123; path=.example.invalid'
'Set-Cookie: name=value; Comment="\\012"; expires=123; path=.example.invalid'
What do you think that the snippet above should return?
'Set-Cookie: name=value; Comment="\\012"; expires=Fri, 20 Apr 2018 02:03:13
GMT; path=.example.invalid'
or
'Set-Cookie: name=value; Comment="\\012"; expires=Fri, 20 Apr 2018 02:03:13
GMT; path=".example.invalid"'
or
'Set-Cookie: name=value; Comment="\\012"; expires=123;
path=".example.invalid"'
?
I don't think the path attribute (or all of them) needs to be quoted
unconditionally. Looking at https://tools.ietf.org/html/rfc6265#section-4.1.1,
it looks like quoting for cookie-value is optional.
Is there a use case or examples from other programming languages you can share
with us?
----------
versions: +Python 3.7, Python 3.8 -Python 3.4, Python 3.5
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue991266>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com