New submission from MeiK <meik2...@gmail.com>:

http.cookies.BaseCookie[1] can't parse Expires in this format like 
Expires=Thu,31 Jan 2019 05:56:00 GMT;(Less space after Thu,).

I encountered this problem in actual use, Chrome, IE and Firefox can parse this 
string normally. Many languages, such as JavaScript, can also parse this data 
automatically.

I built a test site using Flask: https://paste.ubuntu.com/p/K7Z4K4KH7Z/, Use 
curl and requests to get cookies correctly, but not with aiohttp (because it 
uses http.cookies.BaseCookie).

Looking at MDN[2] and rfc[3](Thanks tirkarthi), this doesn't seem to be a 
canonical behavior, But some Java WEB frameworks will produce this behavior 
(such as the one that caused me to find the problem).

This problem can be solved by modifying a regular expression[4], but I don't 
know if it should be compatible with this non-standard way of writing.

English is not my native language; please excuse typing errors.


[1] https://github.com/python/cpython/blob/master/Lib/http/cookies.py#L457
[2] 
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#Directives
[3] https://tools.ietf.org/html/rfc6265#section-4.1.1
[4] https://github.com/python/cpython/blob/master/Lib/http/cookies.py#L444

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35824>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to