[issue37522] http.cookies.SimpleCookie doesn't seem to be parsed using regulars

2019-07-15 Thread SilentGhost


Change by SilentGhost :


--
components: +Library (Lib) -Extension Modules
versions:  -Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue37522] http.cookies.SimpleCookie doesn't seem to be parsed using regulars

2019-07-15 Thread MeiK


Change by MeiK :


--
keywords: +patch
pull_requests: +14577
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/14781

___
Python tracker 

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



[issue37522] http.cookies.SimpleCookie doesn't seem to be parsed using regulars

2019-07-08 Thread MeiK

New submission from MeiK :

In Python's built-in SimpleCookie[1], regular expressions are used to parse 
cookies, which seems to be a non-standard way.

I looked at the RFC documentation related to cookie resolution: rfc2109[2] and 
rfc6265[3], the former has been replaced by the latter. These documents 
stipulate that cookies should be split with a semicolon, just like 
http.cookiejar.parse_ns_headers[4].

But if we use the approach described in the documentation, then there will be a 
set of tests that fail[5].

Current:
>>> print(SimpleCookie('keebler="E=mc2; L=\\"Loves\\"; fudge=\\012;"’))
Set-Cookie: keebler="E=mc2; L=\"Loves\"; fudge=\012;"

Modified:
>>> print(SimpleCookie('keebler="E=mc2; L=\\"Loves\\"; fudge=\\012;"’))
Set-Cookie: keebler="E=mc2

Is this a bug? Should it be modified?

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

[1]: https://github.com/python/cpython/blob/master/Lib/http/cookies.py#L536
[2]: https://www.ietf.org/rfc/rfc2109.txt
[3]: https://www.ietf.org/rfc/rfc6265.txt
[4]: https://github.com/python/cpython/blob/master/Lib/http/cookiejar.py#L453
[5]: 
https://github.com/python/cpython/blob/master/Lib/test/test_http_cookies.py#L19

--
components: Extension Modules
messages: 347494
nosy: MeiK
priority: normal
severity: normal
status: open
title: http.cookies.SimpleCookie doesn't seem to be parsed using regulars
type: enhancement
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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