From 6d433af4069611bfdf2896b47ae47cd8db72d08e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=2E=20K=C3=A4rkk=C3=A4inen?= <98187+Tronic@users.noreply.github.com> Date: Sat, 14 Oct 2023 18:27:26 +0000 Subject: [PATCH] Accept bare cookies --- sanic/cookies/request.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sanic/cookies/request.py b/sanic/cookies/request.py index 456c887272..7b23e09648 100644 --- a/sanic/cookies/request.py +++ b/sanic/cookies/request.py @@ -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