From 52750191f18ef240514cf606640fa0e926d6e11d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 10 Nov 2019 18:27:31 +0530 Subject: [PATCH] Dont spam server log with errors when timing out connections that never even get ready --- src/calibre/srv/http_request.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/srv/http_request.py b/src/calibre/srv/http_request.py index 57f840156c..4d01aaade6 100644 --- a/src/calibre/srv/http_request.py +++ b/src/calibre/srv/http_request.py @@ -404,7 +404,9 @@ class HTTPRequest(Connection): self.set_state(READ, self.read_chunk_length, inheaders, Accumulator(), buf, bytes_read) 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 self.simple_response(http_client.REQUEST_TIMEOUT) return True