It seems uwsgi remembers headers from a previous request in async mode!
I deployed a very simple application with uwsgi:
def application(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/plain')])
environ_repr = '\n'.join(sorted(key.ljust(30) + ' = ' + repr(value) for key, value in environ.items()))
return [environ_repr]
and ran it with:
uwsgi --module index -s 0.0.0.0:8000 -p 1 --async 5
Steps to regenerate the problem:
- Visit 127.0.0.1:8000 with header “Key: Value”, there is
HTTP_KEYentry inenvironment, OK. - Now, visit 127.0.0.1:8000 without that header, but
HTTP_KEYentry still is presentenvironment, oopch!
Note: Same thing happens with other headers like Cookie!
(Tested with uwsgi 1.0, 1.2.4 and 1.3-dev, and python 2.7)
There was a bug in uwsgi and fixed in:
https://github.com/unbit/uwsgi/commit/e393f36f0adbdb49e4a84098865bb6e3c01785e4