uwsgi resends headers in async mode

白昼怎懂夜的黑 提交于 2019-12-13 06:24:57

问题


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_KEY entry in environment, OK.
  • Now, visit 127.0.0.1:8000 without that header, but HTTP_KEY entry still is present environment, 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)


回答1:


There was a bug in uwsgi and fixed in:

https://github.com/unbit/uwsgi/commit/e393f36f0adbdb49e4a84098865bb6e3c01785e4



来源:https://stackoverflow.com/questions/11598935/uwsgi-resends-headers-in-async-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!