FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-149028: Revert gh-92936 changes by serhiy-storchaka · Pull Request #149182 · python/cpython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) .rst  (2) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
11 changes: 1 addition & 10 deletions Doc/library/http.cookies.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ The character set, :data:`string.ascii_letters`, :data:`string.digits` and
in a cookie name (as :attr:`~Morsel.key`).

.. versionchanged:: 3.3
Allowed '``:``' as a valid cookie name character.
Allowed ':' as a valid cookie name character.

.. versionchanged:: 3.15
Allowed '``"``' as a valid cookie value character.

.. note::

Expand Down Expand Up @@ -313,10 +311,3 @@ The following example demonstrates how to use the :mod:`!http.cookies` module.
>>> print(C)
Set-Cookie: number=7
Set-Cookie: string=seven
>>> import json
>>> C = cookies.SimpleCookie()
>>> C.load(f'cookies=7; mixins="{json.dumps({"chips": "dark chocolate"})}"; state=gooey')
>>> print(C)
Set-Cookie: cookies=7
Set-Cookie: mixins="{"chips": "dark chocolate"}"
Set-Cookie: state=gooey
7 changes: 0 additions & 7 deletions Doc/whatsnew/3.15.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -938,13 +938,6 @@ http.client
(Contributed by Alexander Enrique Urieles Nieto in :gh:`131724`.)


http.cookies
------------

* Allow '``"``' double quotes in cookie values.
(Contributed by Nick Burns and Senthil Kumaran in :gh:`92936`.)


http.server
-----------

Expand Down
2 changes: 1 addition & 1 deletion Lib/http/cookies.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ def OutputString(self, attrs=None):
( # Optional group: there may not be a value.
\s*=\s* # Equal Sign
(?P<val> # Start of group 'val'
"(?:\\"|.)*?" # Any double-quoted string
"(?:[^\\"]|\\.)*" # Any double-quoted string
| # or
# Special case for "expires" attr
(\w{3,6}day|\w{3}),\s # Day of the week or abbreviated day
Expand Down
23 changes: 0 additions & 23 deletions Lib/test/test_http_cookies.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,6 @@ def test_basic(self):
'Set-Cookie: d=r',
'Set-Cookie: f=h'
))
},

# gh-92936: allow double quote in cookie values
{
'data': 'cookie="{"key": "value"}"',
'dict': {'cookie': '{"key": "value"}'},
'repr': "<SimpleCookie: cookie='{\"key\": \"value\"}'>",
'output': 'Set-Cookie: cookie="{"key": "value"}"',
},
{
'data': 'key="some value; surrounded by quotes"',
'dict': {'key': 'some value; surrounded by quotes'},
'repr': "<SimpleCookie: key='some value; surrounded by quotes'>",
'output': 'Set-Cookie: key="some value; surrounded by quotes"',
},
{
'data': 'session="user123"; preferences="{"theme": "dark"}"',
'dict': {'session': 'user123', 'preferences': '{"theme": "dark"}'},
'repr': "<SimpleCookie: preferences='{\"theme\": \"dark\"}' session='user123'>",
'output': '\n'.join((
'Set-Cookie: preferences="{"theme": "dark"}"',
'Set-Cookie: session="user123"',
))
}
]

Expand Down
Loading

Back | FazBrowse Home | New Git URL