[issue23888] Fixing fractional expiry time bug in cookiejar

2015-05-07 Thread ssh

ssh added the comment:

Thanks for checking in the RFC. I had done that before I posted my 
StackOverflow question, but should have mentioned it here for completeness. 
I've addressed the comments.

--
Added file: http://bugs.python.org/file39315/mywork.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23888
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23888] Fixing fractional expiry time bug in cookiejar

2015-05-06 Thread ssh

ssh added the comment:

Wouldn't int(float(expires) * 1e6) set the date much further in the future? I'm 
not sure why you'd do that unless the plan is to change the internal time unit 
to microseconds (which seems like a much bigger change, and overkill for 
handling this special case). Cookie strings operate at the second granularity, 
so I'm not sure if the sub-second precision is required.

I took a quick look at curl's code and test cases, and they use a time_t 
structure which doesn't have subsecond precision. Fractional time is not a part 
of their test cases.

https://github.com/bagder/curl/blob/6f8046f7a4bd3d6edcc53c2eec936105ec424d54/tests/libtest/lib517.c

https://github.com/bagder/curl/blob/664b9baf67c2c22ebaf3606298ca9c4ce0b382d2/lib/parsedate.c#L331

Wget also appears to do something similar:

http://bzr.savannah.gnu.org/lh/wget/trunk/annotate/head:/src/cookies.c#L387

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23888
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23888] Fixing fractional expiry time bug in cookiejar

2015-05-06 Thread ssh

ssh added the comment:

Attaching patch after addressing comments in code review.

--
Added file: http://bugs.python.org/file39311/mywork.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23888
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23888] Fixing fractional expiry time bug in cookiejar

2015-04-08 Thread ssh

New submission from ssh:

If the FileCookieJar reads a cookie whose expiry time is a decimal fraction, it 
crashes.

Chrome extensions cookies.txt and EdiThisCookie export the expiry time as 
decimal fractions. This is accepted by wget and curl, but not by the 
FileCookieJar which ends up crashing.

I made a StackOverflow question checking if fractional decimal expiry times 
were even allowed (if it was a bug in the extensions), but didn't get a 
response: 
https://stackoverflow.com/questions/29502672/can-the-cookie-expires-field-be-a-decimal-value

At any rate, this patch should make the library more robust.

--
components: Library (Lib)
files: mywork.patch
keywords: patch
messages: 240265
nosy: serhiy.storchaka, ssh
priority: normal
severity: normal
status: open
title: Fixing fractional expiry time bug in cookiejar
type: crash
versions: Python 3.5
Added file: http://bugs.python.org/file38864/mywork.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23888
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com