classification
Title: Same name cookies
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.2
process
Status: closed Resolution: duplicate
Dependencies: Superseder: http.cookies, Cookie.py: Improper handling of duplicate cookies
View: 1375011
Assigned To: Nosy List: amaury.forgeotdarc, chch, mmelin, terry.reedy
Priority: normal Keywords: patch

Created on 2009-12-14 13:54 by chch, last changed 2016-04-25 12:01 by berker.peksag. This issue is now closed.

Files
File name Uploaded Description Edit
Cookie.py.diff chch, 2009-12-14 13:54
Cookie_multi.diff chch, 2009-12-19 08:06 remake with svn review
Messages (8)
msg96375 - (view) Author: Andrey Chichak (chch) Date: 2009-12-14 13:54
After setting cookies with same name and different path only nearest to 
root cookie is available.

Attached patch:
1. Set Cookie to nearest value.
2. Collects all same name values in Cookie._multi['<cookie name>'] in 
order.
msg96595 - (view) Author: Andrey Chichak (chch) Date: 2009-12-19 08:06
Remake for patch due the requirements of 
http://www.python.org/dev/patches/
msg96596 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-12-19 08:31
For this kind of report you should provide more information. Is this an 
enhancement to the Cookie object? Why is it needed?
Do you really propose that users directly use the _multi attribute 
directly (the leading _ suggest an internal attribute)?
Also, some documentation update is necessary (in Doc/library/cookie.rst)
msg96597 - (view) Author: Andrey Chichak (chch) Date: 2009-12-19 09:23
This is fix for rare problem. If I set 2 cookies:
sid=pub.GHoBitAWLt, path="/"
sid=cab.S97jUfeihM, path="/cab"
All browsers in Cookie header send for any URL '/cab*':
sid=cab.S97jUfeihM; sid=pub.GHoBitAWLt
Current implementation always returns Cookie['sid']=pub.GHoBitAWLt - wrong!
My patch resolve this problem and Cookie['sid'] returns first (nearest/deepest in path) cookie value, 
and also collects all same name cookies in dict Cookie._multi .

Name (_multi) may be wrong, and may be any other :o) .

Also I can update documentation, but my English is not so good ...
msg112727 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-08-04 00:04
Unless you can quote something in the manual that says or implies that cookie.py should already have this feature, it looks like a feature request. Is it possible to add a new unittest? Prepare any new patches against py3k branch, now 'trunk'.
msg112753 - (view) Author: Andrey Chichak (chch) Date: 2010-08-04 04:31
1. Cookie.py.diff is fix for error, very rare error.
2. Cookie_multi.diff is extention for supporting same name cookies set for diferent pathes.

Cookie.py contain error!
msg182764 - (view) Author: Martin Melin (mmelin) * Date: 2013-02-23 16:59
FYI, this looks like the same issue as #1375011
msg182817 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-02-23 20:30
Which also has patches.
History
Date User Action Args
2016-04-25 12:01:01berker.peksagsetstatus: open -> closed
superseder: http.cookies, Cookie.py: Improper handling of duplicate cookies
resolution: duplicate
stage: resolved
2013-02-23 20:30:27terry.reedysetmessages: + msg182817
2013-02-23 16:59:22mmelinsetnosy: + mmelin
messages: + msg182764
2010-08-04 04:31:21chchsetmessages: + msg112753
2010-08-04 00:04:42terry.reedysetversions: + Python 3.2, - Python 2.6, Python 2.5, Python 2.4, Python 3.0, Python 3.1, Python 2.7
nosy: + terry.reedy

messages: + msg112727

type: behavior -> enhancement
2009-12-19 09:23:30chchsetmessages: + msg96597
2009-12-19 08:31:10amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg96596
2009-12-19 08:06:07chchsetfiles: + Cookie_multi.diff

messages: + msg96595
2009-12-14 13:54:27chchcreate