Jonathan Schweder <jonathanschwe...@gmail.com> added the comment:

Simple example to reproduce the issue:

from http import cookies
C = cookies.SimpleCookie()
C["ys-api/mpegts/service"] = "blabla"
print(C.output())

@ra1nb0w so far as I have found [1][2], the "/" not a valid character for the 
Cookie name, [3] defines the list of valid characters and [4] is where the 
exception is raised, I also found that even with the RFC browsers have 
different rules for the Cookie name definitions, this could be reason why 
Python has, for example, the ":" character in the list.

My conclusion is that the rule for the cookie name is not well-defined, there 
are some ambiguities here and there, but if we consider purely this case and 
the RFC, the "/" still is not a valid character for the cookie name, so I guess 
the best option for you is to filter it out any http.cookies.CookieError that 
happen.

[1] 
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#attributes
[2] https://datatracker.ietf.org/doc/html/rfc2616#section-2.2
[3] https://github.com/python/cpython/blob/main/Lib/http/cookies.py#L162
[4] https://github.com/python/cpython/blob/main/Lib/http/cookies.py#L353

----------
nosy: +jaswdr

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44104>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to