using HTTPHandler cause Django server side shows http 400 and Invalid HTTP_HOST header message
iMath
redstone-cold at 163.com
Mon Apr 10 12:08:32 EDT 2017
On Tuesday, April 11, 2017 at 12:00:27 AM UTC+8, iMath wrote:
> > Are you sure you posted the code you are actually using? Because the
> > error message suggests a difference.
> >
> I am sure !
>
> As I have tested: If I pass the IP address of my web server to the host parameter of HTTPHandler, the server side would show http 400 and Invalid HTTP_HOST header message ,
>
Besides the http 400 and Invalid HTTP_HOST header message , there are also following exceptions
Invalid HTTP_HOST header: '112.74.98.187:8001,112.74.98.187'. The domain name pr ovided is not valid according to RFC 1034/1035.
[10/Apr/2017 15:38:04] "GET /VideoParser/lYYDownloaderClientLog/?funcName=%3Cmod ule%3E&lineno=26&levelname=ERROR&name=__main__&stack_info=None&args=%28%29&modul e=a&pathname=C%3A%5CUsers%5Ci%5CDocuments%5CTencent+Files%5C2281570025%5CFileRec v%5Ca.py&process=6636&thread=6972&created=1491838715.9931207&msecs=993.120670318 6035&msg=testing+remote+logging&exc_info=None&relativeCreated=64.00370597839355& filename=a.py&threadName=MainThread&processName=MainProcess&levelno=40&exc_text= None HTTP/1.1" 400 66752
Traceback (most recent call last):
File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 138, in run
self.finish_response()
File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 180, in finish_respo nse
self.write(data)
File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 279, in write
self._write(data)
File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 453, in _write
result = self.stdout.write(data)
File "/usr/local/lib/python3.6/socketserver.py", line 775, in write
self._sock.sendall(b)
ConnectionResetError: [Errno 104] Connection reset by peer
[10/Apr/2017 15:38:04] "GET /VideoParser/lYYDownloaderClientLog/?funcName=%3Cmod ule%3E&lineno=26&levelname=ERROR&name=__main__&stack_info=None&args=%28%29&modul e=a&pathname=C%3A%5CUsers%5Ci%5CDocuments%5CTencent+Files%5C2281570025%5CFileRec v%5Ca.py&process=6636&thread=6972&created=1491838715.9931207&msecs=993.120670318 6035&msg=testing+remote+logging&exc_info=None&relativeCreated=64.00370597839355& filename=a.py&threadName=MainThread&processName=MainProcess&levelno=40&exc_text= None HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('117.136.84.223', 49862)
Traceback (most recent call last):
File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 138, in run
self.finish_response()
File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 180, in finish_respo nse
self.write(data)
File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 279, in write
self._write(data)
File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 453, in _write
result = self.stdout.write(data)
File "/usr/local/lib/python3.6/socketserver.py", line 775, in write
self._sock.sendall(b)
ConnectionResetError: [Errno 104] Connection reset by peer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 141, in run
self.handle_error()
File "/usr/local/lib/python3.6/site-packages/django/core/servers/basehttp.py", line 95, in handle_error
super(ServerHandler, self).handle_error()
File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 368, in handle_error
self.finish_response()
File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 180, in finish_respo nse
self.write(data)
File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 274, in write
self.send_headers()
File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 344, in client_is_mo dern
return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
TypeError: 'NoneType' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/socketserver.py", line 639, in process_request_ thread
self.finish_request(request, client_address)
File "/usr/local/lib/python3.6/socketserver.py", line 361, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/lib/python3.6/socketserver.py", line 696, in __init__
self.handle()
File "/usr/local/lib/python3.6/site-packages/django/core/servers/basehttp.py", line 174, in handle
handler.run(self.server.get_app())
File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 144, in run
self.close()
File "/usr/local/lib/python3.6/wsgiref/simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------
More information about the Python-list
mailing list