本文介绍了uwsgi重新发送在异步模式头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这似乎uwsgi记得头从在异步模式下的previous要求!

It seems uwsgi remembers headers from a previous request in async mode!

我部署一个uwsgi非常简单的应用:

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:


  • 访问127.0.0.1:8000与头键:值,有 HTTP_KEY 环境条目, OK。

  • 现在,请访问127.0.0.1:8000没有这个头,但 HTTP_KEY 项仍然是present 环境,oopch!

  • 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!

(与uwsgi 1.0,1.2.4和1.3-dev的,和Python 2.7测试)

(Tested with uwsgi 1.0, 1.2.4 and 1.3-dev, and python 2.7)

推荐答案

有在uwsgi一个bug,修复:

There was a bug in uwsgi and fixed in:

这篇关于uwsgi重新发送在异步模式头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 18:17