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

This commit is contained in:
Noah Levitt 2017-05-04 12:54:04 -07:00
parent 11e11f4e68
commit b2f08535ae
2 changed files with 2 additions and 5 deletions

View File

@ -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',

View File

@ -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,