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

Andres Riancho report at bugs.python.org
Fri Oct 10 04:15:33 CEST 2008


Andres Riancho <andresriancho at users.sourceforge.net> added the comment:

My problem, and the problem if the original bug reporter (sirilyan) is
that the load method ignores names that don't have values. Quoting the
original bug report:

>>> import Cookie
>>> q = Cookie.SimpleCookie("pie=good; broken;
other=thing")
>>> q
<SimpleCookie: other='thing' pie='good'>

The original bug report suggested raising a warning or something. I
don't like that idea too much. What I would like to see is the "secure"
cookie parameter, which BY RFC has no value, be parsed as expected.

Right now is you .load() a cookie that looks like this: "a=b; secure"
and then you want to write that cookie back, you loose the secure parameter!

dz0 at brick:~$ python
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()
>>> C.load("chips=ahoy; vienna=finger")
>>> print C
Set-Cookie: chips=ahoy
Set-Cookie: vienna=finger
>>> C.load("chips=ahoy; vienna=finger; secure")
>>> print C
Set-Cookie: chips=ahoy
Set-Cookie: vienna=finger
>>> 

I'm not sure if I'm being clear enough, please tell me if you need me to
rewrite something, or use other examples.

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


More information about the Python-bugs-list mailing list