unbit/uwsgitop — pull request #17 by gecka (2014-05-27 11:33:48+00:00)
Title: Added striping of HTTP_COOKIE header

uWSGI stats server returns environment variables inside "cores" list. That list contains HTTP_COOKIE header. That header can contain octal-escaped characters and that will raise ValueError during json parsing. I think the simplest way is just to strip that header at all since it doesn't used for any data.

Example of traceback:

Traceback (most recent call last):
File "/usr/local/bin/uwsgitop", line 114, in
dd = json.loads(js)
File "/usr/lib/python2.7/json/__init__.py", line 326, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 365, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 381, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Invalid \escape: line 243 column 486 (char 4854)