[issue22296] cookielib uses time.time(), making incorrect checks of expiration times in cookies

2014-09-01 Thread Rebecka

Rebecka added the comment:

Akira is correct: using time.mktime to produce the expiration date for the 
cookie is wrong (thank you very much for the pointers!).

Using e.g. http.cookiejar.http2time with a HTTP formatted date string gives a 
correct time stamp (with which cookie.is_expired succeeds), so this was not a 
bug (just user error...).

--
resolution:  -> not a bug
status: open -> closed

___
Python tracker 
<http://bugs.python.org/issue22296>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22296] cookielib uses time.time(), making incorrect checks of expiration times in cookies

2014-09-01 Thread Rebecka

Rebecka added the comment:

I've checked and an updated test file for 3.4 shows the same behaviour in the 
renamed module http.cookiejar.

Even though no standard exists I hope 3.4+ would be changed to simplify the 
cookie handling, since there is a lot of hassle converting UTC times to local 
times (which in general should be avoided to avoid introducing further problems 
with e.g. daylight savings).

--
Added file: http://bugs.python.org/file36519/cookie_timestamp_test_3.4.py

___
Python tracker 
<http://bugs.python.org/issue22296>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22296] cookielib uses time.time(), making incorrect checks of expiration times in cookies

2014-08-29 Thread Rebecka

New submission from Rebecka:

The cookielib module uses time.time(), which produces a timestamp in the local 
timezone (as read from the system time?), as the timestamp against which 
expiration dates in cookies are compared.

However, typical usage of HTTP cookies would be specifying the expiration date 
in UTC. This assumption seems to be supported for example by the inclusion of 
cookielib.http2time, which (only) supports UTC timestamps.

This behaviour is also included in e.g. MozillaCookieJar, which (erroneously) 
excludes cookies from being saved/loaded based on the local timestamp from 
time.time().

See the attached file for a small example where the check if a cookie is 
expired against a UTC time is correct but the check against local time fails 
(simulating the behaviour of the cookielib module).

--
components: Library (Lib)
files: cookie_timestamp_test.py
messages: 226056
nosy: regu0004
priority: normal
severity: normal
status: open
title: cookielib uses time.time(), making incorrect checks of expiration times 
in cookies
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file36502/cookie_timestamp_test.py

___
Python tracker 
<http://bugs.python.org/issue22296>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com