Bug report
Bug description:
SimpleCookie.load() extracts cookie names using _LegalKeyChars, which deliberately admits characters RFC 6265 forbids in a token — the comment above it cites MSIE non-compliance as the reason. Morsel.set() then validates with _is_legal_key, built from _LegalChars, which excludes them. Twelve separator characters differ, so any Set-Cookie whose name contains one raises CookieError even though the module's own parser accepted it.
Encountered in the wild: F5 BIG-IP load balancers emit a persistence cookie named for the partition path, /Common/.app/--pool. Browsers accept this...
from http.cookies import SimpleCookie
SimpleCookie('/a/b=1') # also a@b=1, a,b=1, a(b)=1
CPython versions tested on:
3.14
Operating systems tested on:
Linux
Bug report
Bug description:
SimpleCookie.load()extracts cookie names using_LegalKeyChars, which deliberately admits characters RFC 6265 forbids in a token — the comment above it cites MSIE non-compliance as the reason.Morsel.set()then validates with_is_legal_key, built from_LegalChars, which excludes them. Twelve separator characters differ, so anySet-Cookiewhose name contains one raisesCookieErroreven though the module's own parser accepted it.Encountered in the wild: F5 BIG-IP load balancers emit a persistence cookie named for the partition path, /Common/.app/--pool. Browsers accept this...
CPython versions tested on:
3.14
Operating systems tested on:
Linux