Commit d54a13df authored by Denis Bilenko's avatar Denis Bilenko

pywsgi: readout request data to prevent ECONNRESET

error: [Errno 104] Connection reset by peer
parent aadb5251
...@@ -195,8 +195,12 @@ class WSGIHandler(object): ...@@ -195,8 +195,12 @@ class WSGIHandler(object):
finally: finally:
if self.socket is not None: if self.socket is not None:
try: try:
self.socket._sock.close() # do not rely on garbage collection # read out request data to prevent error: [Errno 104] Connection reset by peer
self.socket.close() try:
self.socket._sock.recv(16384)
finally:
self.socket._sock.close() # do not rely on garbage collection
self.socket.close()
except socket.error: except socket.error:
pass pass
self.__dict__.pop('socket', None) self.__dict__.pop('socket', None)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment