[New-bugs-announce] [issue17164] MozillaCookieJar does not handle session cookies

Piotr Dobrogost report at bugs.python.org
Fri Feb 8 22:23:23 CET 2013

New submission from Piotr Dobrogost:

It seems there's no information on how should session cookies be stored in the Netscape/Mozilla's cookies.txt file with regard to expiry time - see http://www.cookiecentral.com/faq/#3.5 Maybe Netscape has not been saving such cookies at all thus this lack of specification? Nevertheless, both wget and curl use 0 as expiry time to denote session cookies; it works both when reading cookies from file and writing to file. However Python's MozillaCookieJar's class uses empty string for the same purpose which makes it incompatible both with wget and curl - see http://hg.python.org/cpython/file/bd8afb90ebf2/Lib/http/cookiejar.py#l2027

I propose to make a change in implementation of MozillaCookieJar class and treat cookies with 0 set as expiry time as session cookies both when reading from a file and writing to a file.

Motivation for this bug report comes from the following question on Stack Overflow - http://stackoverflow.com/q/14742899/95735

components: Library (Lib)
messages: 181703
nosy: piotr.dobrogost
priority: normal
severity: normal
status: open
title: MozillaCookieJar does not handle session cookies
type: behavior
versions: Python 3.4, Python 3.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list