[issue35824] http.cookies._CookiePattern modifying regular expressions

MeiK report at bugs.python.org
Mon Apr 22 22:19:22 EDT 2019


MeiK <meik2333 at gmail.com> added the comment:

You are right, I saw the agreed way of parsing in RFC6265[1], it seems that you should not use regular expressions.

I used http.cookiejar to update the code, but it failed to pass the test: https://github.com/python/cpython/blob/master/Lib/test/test_http_cookies.py#L19. However, other languages and libraries (JavaScript, Requests, http.cookiejar, etc.) cannot parse it. It seems that the contents of the brackets should be escaped. Is this a wrong test case?

I updated the code[2] using http.cookiejar. Is this a good idea?

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

[1] https://tools.ietf.org/html/rfc6265
[2] https://github.com/python/cpython/pull/11665/commits/a03bc75348a4041c7411da3175689c087a98789f

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35824>
_______________________________________


More information about the Python-bugs-list mailing list