Python 允许逐跳标头Django
我正在用Django 1.6和Python 3.4编写一个演示代理服务器。当响应包含以下标题时,我收到一个错误:Python 允许逐跳标头Django,python,django,wsgi,chunked,Python,Django,Wsgi,Chunked,我正在用Django 1.6和Python 3.4编写一个演示代理服务器。当响应包含以下标题时,我收到一个错误: Transfer-Encoding=chunked 错误是: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 137, in run self.result
Transfer-Encoding=chunked
错误是:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 137, in run
self.result = application(self.environ, self.start_response)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/contrib/staticfiles/handlers.py", line 67, in __call__
return self.application(environ, start_response)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/core/handlers/wsgi.py", line 214, in __call__
start_response(force_str(status), response_headers)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 236, in start_response
assert not is_hop_by_hop(name),"Hop-by-hop headers not allowed"
AssertionError: Hop-by-hop headers not allowed
我发现了这个问题:但Django 1.6似乎没有basehttp.\u-hop\u头文件
我使用python3.4 manage.py运行服务器
请帮助以下HTTP/1.1头是wsgiref不允许的逐跳头:
- Connection
- Keep-Alive
- Proxy-Authenticate
- Proxy-Authorization
- TE
- Trailers
- Transfer-Encoding
- Upgrade
见:
“带有django的演示代理服务器”?为什么要用django编写代理服务器?最好使用Python和类似的东西。Django 1.6和Python 2.7也有类似的问题。我怀疑这就是manage.py的工作方式。我的团队的另一名成员能够设置在uWSGI下运行的传输编码头,并且它运行时没有错误。
\u hop\u头现在处于运行状态。