我正在用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 = 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
我发现了这个问题:Allow hop-by-hop headers in Django proxy middleware但似乎Django 1.6没有basehttp._hop_headers
。
我使用python3.4 manage.py runserver
运行服务器。
请帮忙
答案 0 :(得分:5)
以下HTTP / 1.1标头是wsgiref不允许的逐跳标头:
- Connection
- Keep-Alive
- Proxy-Authenticate
- Proxy-Authorization
- TE
- Trailers
- Transfer-Encoding
- Upgrade
请参阅: