New submission from ra1nb0w <rain...@irh.it>:

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

----------
messages: 393426
nosy: ra1nb0w
priority: normal
severity: normal
status: open
title: http.cookies.CookieError: Illegal key
versions: Python 3.7

_______________________________________
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