[ python-Bugs-1372650 ] Cookie and multiple names

SourceForge.net noreply at sourceforge.net
Sun Dec 4 17:07:25 CET 2005

Bugs item #1372650, was opened at 2005-12-03 18:47
Message generated for change (Comment added) made by valankar
You can respond by visiting: 

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Viraj Alankar (valankar)
Assigned to: Nobody/Anonymous (nobody)
Summary: Cookie and multiple names

Initial Comment:
The cookie specification described here:


states that multiple names of cookies can be sent. This does not seem 
to parse correctly with the Cookie module due to its dictionary storage.  
When parsing cookies via modpython, only the last cookie is used. I 
think it would be better to only use the first value, since that is what 
the specification says. Or provide for a way to store multiple names 
with different paths.


>Comment By: Viraj Alankar (valankar)
Date: 2005-12-04 07:07

Logged In: YES 

Basically, sometimes a web client will send 2 instances of the same name:

Cookie: mycookie=foo; mycookie=bar

The specs say that the first one is the one that should be used. The other 
cookies listed are the inherited ones from paths that a prefix of the current 
URL. When this is parsed by the Cookie module, mycookie gets set to bar 
when it should be foo.

Another example might be:

Cookie: mycookie=foo; path=bar
Cookie: mycookie=foo; path=baz

In this case there should be 2 cookies with the name 'mycookie'. The 
uniqueness is determined by the different paths.



Comment By: John J Lee (jjlee)
Date: 2005-12-04 06:52

Logged In: YES 

I don't get it:

>>> import Cookie
>>> c = Cookie.SimpleCookie()
>>> c.load("foo=bar; bar=baz")
>>> c
<SimpleCookie: bar='baz' foo='bar'>

Where's the problem?

In general, don't pay too much attention to that standard, BTW:



You can respond by visiting: 

More information about the Python-bugs-list mailing list