Accept bare cookies

This commit is contained in:
L. Kärkkäinen 2023-10-14 18:27:26 +00:00 committed by GitHub
parent a5a9658896
commit 6d433af406
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,13 +73,15 @@ def parse_cookie(raw: str) -> Dict[str, List[str]]:
cookies: Dict[str, List[str]] = {}
for token in raw.split(";"):
name, __, value = token.partition("=")
name, sep, value = token.partition("=")
name = name.strip()
value = value.strip()
if not name:
continue
# Support cookies =value or plain value with no name
# https://github.com/httpwg/http-extensions/issues/159
if not sep:
name, value = "", name
if COOKIE_NAME_RESERVED_CHARS.search(name): # no cov
continue