From b2f08535aee27fab5fde52d4ef52f37558ead3b0 Mon Sep 17 00:00:00 2001 From: Noah Levitt Date: Thu, 4 May 2017 12:54:04 -0700 Subject: [PATCH] set method when creating ProxyingRecordingHTTPResponse so that it knows when to close the connection, and HEAD requests don't sit around trying to read more data until socket timeout --- setup.py | 2 +- warcprox/mitmproxy.py | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index ad95a1e..382e43b 100755 --- a/setup.py +++ b/setup.py @@ -51,7 +51,7 @@ except: setuptools.setup( name='warcprox', - version='2.1b1.dev74', + version='2.1b1.dev75', description='WARC writing MITM HTTP/S proxy', url='https://github.com/internetarchive/warcprox', author='Noah Levitt', diff --git a/warcprox/mitmproxy.py b/warcprox/mitmproxy.py index 951eb0e..5d1e036 100644 --- a/warcprox/mitmproxy.py +++ b/warcprox/mitmproxy.py @@ -397,7 +397,7 @@ class MitmProxyHandler(http_server.BaseHTTPRequestHandler): prox_rec_res = ProxyingRecordingHTTPResponse( self._remote_server_sock, proxy_client=self.connection, digest_algorithm=self.server.digest_algorithm, - url=self.url) + url=self.url, method=self.command) prox_rec_res.begin() buf = prox_rec_res.read(8192) @@ -405,9 +405,6 @@ class MitmProxyHandler(http_server.BaseHTTPRequestHandler): buf = prox_rec_res.read(8192) self.log_request(prox_rec_res.status, prox_rec_res.recorder.len) - except socket.timeout as e: - self.logger.warn( - "%s proxying %s %s", repr(e), self.command, self.url) except Exception as e: self.logger.error( "%s proxying %s %s", repr(e), self.command, self.url,