mirror of
https://github.com/internetarchive/warcprox.git
synced 2025-01-18 13:22:09 +01:00
fix python2 tests
This commit is contained in:
parent
1bca9d0324
commit
8bfda9f4b3
2
setup.py
2
setup.py
@ -49,7 +49,7 @@ except:
|
|||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name='warcprox',
|
name='warcprox',
|
||||||
version='2.2b1.dev99',
|
version='2.2b1.dev100',
|
||||||
description='WARC writing MITM HTTP/S proxy',
|
description='WARC writing MITM HTTP/S proxy',
|
||||||
url='https://github.com/internetarchive/warcprox',
|
url='https://github.com/internetarchive/warcprox',
|
||||||
author='Noah Levitt',
|
author='Noah Levitt',
|
||||||
|
@ -186,14 +186,22 @@ class WarcProxyHandler(warcprox.mitmproxy.MitmProxyHandler):
|
|||||||
req, prox_rec_res = warcprox.mitmproxy.MitmProxyHandler._proxy_request(
|
req, prox_rec_res = warcprox.mitmproxy.MitmProxyHandler._proxy_request(
|
||||||
self)
|
self)
|
||||||
|
|
||||||
|
content_type = None
|
||||||
|
try:
|
||||||
|
content_type = prox_rec_res.headers.get('content-type')
|
||||||
|
except AttributeError: # py2
|
||||||
|
raw = prox_rec_res.msg.getrawheader('content-type')
|
||||||
|
if raw:
|
||||||
|
content_type = raw.strip()
|
||||||
|
|
||||||
recorded_url = RecordedUrl(
|
recorded_url = RecordedUrl(
|
||||||
url=self.url, request_data=req,
|
url=self.url, request_data=req,
|
||||||
response_recorder=prox_rec_res.recorder, remote_ip=remote_ip,
|
response_recorder=prox_rec_res.recorder, remote_ip=remote_ip,
|
||||||
warcprox_meta=warcprox_meta, status=prox_rec_res.status,
|
warcprox_meta=warcprox_meta, status=prox_rec_res.status,
|
||||||
size=prox_rec_res.recorder.len,
|
size=prox_rec_res.recorder.len,
|
||||||
client_ip=self.client_address[0],
|
client_ip=self.client_address[0],
|
||||||
content_type=prox_rec_res.headers.get("Content-Type"),
|
content_type=content_type, method=self.command,
|
||||||
method=self.command, timestamp=timestamp, host=self.hostname,
|
timestamp=timestamp, host=self.hostname,
|
||||||
duration=datetime.datetime.utcnow()-timestamp)
|
duration=datetime.datetime.utcnow()-timestamp)
|
||||||
self.server.recorded_url_q.put(recorded_url)
|
self.server.recorded_url_q.put(recorded_url)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user