This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ra1nb0w
Recipients ra1nb0w
Date 2021-05-10.18:30:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1620671460.12.0.286608999298.issue44104@roundup.psfhosted.org>
In-reply-to
Content
The issue arises when there are multiple web applications using the same hostname and a "bad" cookie is stored; the first one (ex. tvheadend) sets a cookie like 'ys-api/mpegts/service=blabla' and the second is a python one that crash with the following:

May 10 18:56:37 hos openwebrx[4575]: Exception happened during processing of request from ('192.168.178.203', 56994)
May 10 18:56:37 hos openwebrx[4575]: Traceback (most recent call last):
May 10 18:56:37 hos openwebrx[4575]:   File "/usr/lib/python3.7/socketserver.py", line 650, in process_request_thread
May 10 18:56:37 hos openwebrx[4575]:     self.finish_request(request, client_address)
May 10 18:56:37 hos openwebrx[4575]:   File "/usr/lib/python3.7/socketserver.py", line 360, in finish_request
May 10 18:56:37 hos openwebrx[4575]:     self.RequestHandlerClass(request, client_address, self)
May 10 18:56:37 hos openwebrx[4575]:   File "/usr/lib/python3/dist-packages/owrx/http.py", line 40, in __init__
May 10 18:56:37 hos openwebrx[4575]:     super().__init__(request, client_address, server)
May 10 18:56:37 hos openwebrx[4575]:   File "/usr/lib/python3.7/socketserver.py", line 720, in __init__
May 10 18:56:37 hos openwebrx[4575]:     self.handle()
May 10 18:56:37 hos openwebrx[4575]:   File "/usr/lib/python3.7/http/server.py", line 426, in handle
May 10 18:56:37 hos openwebrx[4575]:     self.handle_one_request()
May 10 18:56:37 hos openwebrx[4575]:   File "/usr/lib/python3.7/http/server.py", line 414, in handle_one_request
May 10 18:56:37 hos openwebrx[4575]:     method()
May 10 18:56:37 hos openwebrx[4575]:   File "/usr/lib/python3/dist-packages/owrx/http.py", line 46, in do_GET
May 10 18:56:37 hos openwebrx[4575]:     self.router.route(self, self._build_request("GET"))
May 10 18:56:37 hos openwebrx[4575]:   File "/usr/lib/python3/dist-packages/owrx/http.py", line 55, in _build_request
May 10 18:56:37 hos openwebrx[4575]:     return Request(self.path, method, self.headers)
May 10 18:56:37 hos openwebrx[4575]:   File "/usr/lib/python3/dist-packages/owrx/http.py", line 68, in __init__
May 10 18:56:37 hos openwebrx[4575]:     self.cookies.load(headers["Cookie"])
May 10 18:56:37 hos openwebrx[4575]:   File "/usr/lib/python3.7/http/cookies.py", line 529, in load
May 10 18:56:37 hos openwebrx[4575]:     self.__parse_string(rawdata)
May 10 18:56:37 hos openwebrx[4575]:   File "/usr/lib/python3.7/http/cookies.py", line 593, in __parse_string
May 10 18:56:37 hos openwebrx[4575]:     self.__set(key, rval, cval)
May 10 18:56:37 hos openwebrx[4575]:   File "/usr/lib/python3.7/http/cookies.py", line 485, in __set
May 10 18:56:37 hos openwebrx[4575]:     M.set(key, real_value, coded_value)
May 10 18:56:37 hos openwebrx[4575]:   File "/usr/lib/python3.7/http/cookies.py", line 352, in set
May 10 18:56:37 hos openwebrx[4575]:     raise CookieError('Illegal key %r' % (key,))
May 10 18:56:37 hos openwebrx[4575]: http.cookies.CookieError: Illegal key 'ys-api/mpegts/service'

Is there a way to avoid this (just a warning) or the only solution is to filter the load(headers["Cookie"]) input?

thank you
History
Date User Action Args
2021-05-10 18:31:00ra1nb0wsetrecipients: + ra1nb0w
2021-05-10 18:31:00ra1nb0wsetmessageid: <1620671460.12.0.286608999298.issue44104@roundup.psfhosted.org>
2021-05-10 18:31:00ra1nb0wlinkissue44104 messages
2021-05-10 18:30:59ra1nb0wcreate