[New-bugs-announce] [issue32755] Several cookies with the same name get intermixed
Юрий Пухальский
report at bugs.python.org
Sat Feb 3 05:03:48 EST 2018
New submission from Юрий Пухальский <aikipooh at gmail.com>:
I'm using python 3.5.4.
The site gives me two headers:
<CIMultiDictProxy(... 'Set-Cookie': 'LOGIN_SESSION=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/; domain=.etoday.co.kr', 'Set-Cookie': 'LOGIN_SESSION=18676-0.53621000; path=/; domain=.etoday.co.kr' ... )>
I'm using aiohttp that iterates the headers and if it's set-cookie, calls SimpleCookie.load(). The latter maintains a dict inside by the cookie name.
So that's what happens, first we add a dict entry with LOGIN_SESSION=deleted and phony expiration date. Next cookie, the valid one, gets into the same dict entry, updates the value to the right one, but expiration date remains in the past. The result is that this cookie is not used.
I don't know the good way of handling it. Maybe clear the cookie fields before updating the dict? Or this behaviour is intended? I think the situation itself is wrong, the site shouldn't be sending this, but how to cope with it?
----------
components: Extension Modules
messages: 311544
nosy: Юрий Пухальский
priority: normal
severity: normal
status: open
title: Several cookies with the same name get intermixed
type: behavior
versions: Python 3.5
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32755>
_______________________________________
More information about the New-bugs-announce
mailing list