[issue1028088] Cookies without values are silently ignored (by design?)

John J Lee report at bugs.python.org
Fri Oct 10 01:29:13 CEST 2008


John J Lee <jjlee at users.sourceforge.net> added the comment:

You haven't said what the specific problem is.  Note that the
SimpleCookie class really represents a set of cookies, and the Morsel
class represents a single cookie.  It seems that setting special
value-less cookie-attributes like "secure" works:

Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) 
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Cookie
>>> c = Cookie.SimpleCookie("spam=eggs; foo=bar")
>>> c.output()
'Set-Cookie: foo=bar\r\nSet-Cookie: spam=eggs'
>>> c["foo"]["secure"] = 1
>>> c.output()
'Set-Cookie: foo=bar; secure\r\nSet-Cookie: spam=eggs'

HttpOnly support was added here:

http://bugs.python.org/issue1638033

However, I don't know why BaseCookie.load() treats "secure" or
"HttpOnly" specially at all -- those names are not special in Cookie:
heders.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1028088>
_______________________________________


More information about the Python-bugs-list mailing list