Explicitly call Twisted transport stopProducing() on HTTP/1.0 timeouts

This commit is contained in:
Paul Tremberth 2016-02-22 18:44:22 +01:00
parent a0c5c61855
commit 4547a7e759
1 changed files with 5 additions and 0 deletions

View File

@ -83,6 +83,11 @@ class ScrapyHTTPPageGetter(HTTPClient):
def timeout(self):
self.transport.loseConnection()
# transport cleanup needed for HTTPS connections
if self.factory.url.startswith(b'https'):
self.transport.stopProducing()
self.factory.noPage(\
defer.TimeoutError("Getting %s took longer than %s seconds." % \
(self.factory.url, self.factory.timeout)))