Dont spam server log with errors when timing out connections that never even get ready

This commit is contained in:
Kovid Goyal 2019-11-10 18:27:31 +05:30
parent 228453fb48
commit 52750191f1
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -404,7 +404,9 @@ class HTTPRequest(Connection):
self.set_state(READ, self.read_chunk_length, inheaders, Accumulator(), buf, bytes_read) self.set_state(READ, self.read_chunk_length, inheaders, Accumulator(), buf, bytes_read)
def handle_timeout(self): def handle_timeout(self):
if self.response_started: if not hasattr(self, 'response_protocol') or self.response_started:
# Either connection is not ready or a response has already bee
# started
return False return False
self.simple_response(http_client.REQUEST_TIMEOUT) self.simple_response(http_client.REQUEST_TIMEOUT)
return True return True