Skip to content

Commit

Permalink
Accept bare cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
Tronic authored Oct 14, 2023
1 parent a5a9658 commit 6d433af
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sanic/cookies/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 6d433af

Please sign in to comment.