Closed jvdboog closed 3 months ago
The error appears to be with an empty cookie key, not the value:
File "/usr/local/lib/python3.11/http/cookies.py", line 498, in __setitem__
self.__set(key, rval, cval)
File "/usr/local/lib/python3.11/http/cookies.py", line 488, in __set
M.set(key, real_value, coded_value)
File "/usr/local/lib/python3.11/http/cookies.py", line 353, in set
raise CookieError('Illegal key %r' % (key,))
http.cookies.CookieError: Illegal key ''
Empty value works:
curl 'http://localhost:8000/magnet/jobs' -H 'Cookie: key='
However, supplying an empty key would result in the same error as mentioned:
curl 'http://localhost:8000/magnet/jobs' -H 'Cookie: =value'
My bad, it has been fixed with the new commit.
No problem 🙏🏼 Since the value itself isn't an issue, we can skip filtering cookies based on their values. We only need to filter if the key is empty.
I have also allowed passing cookies with empty value in 4fb93a99 since it's not causing exceptions.
I got the following error:
To fix this I added an extra check that the cookie is not passed through when the value of the cookie is empty.