From 1bca9d03242ea3ba65dd3a48e4e523a9fea2512a Mon Sep 17 00:00:00 2001 From: Noah Levitt Date: Mon, 18 Sep 2017 14:45:16 -0700 Subject: [PATCH] don't use http.client.HTTPResponse.getheader() to get the content-type header, because it can return a comma-delimited string --- setup.py | 2 +- warcprox/warcproxy.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 20fceb2..01ef253 100755 --- a/setup.py +++ b/setup.py @@ -49,7 +49,7 @@ except: setuptools.setup( name='warcprox', - version='2.2b1.dev98', + version='2.2b1.dev99', description='WARC writing MITM HTTP/S proxy', url='https://github.com/internetarchive/warcprox', author='Noah Levitt', diff --git a/warcprox/warcproxy.py b/warcprox/warcproxy.py index b6c96d6..e49d44d 100644 --- a/warcprox/warcproxy.py +++ b/warcprox/warcproxy.py @@ -192,7 +192,7 @@ class WarcProxyHandler(warcprox.mitmproxy.MitmProxyHandler): warcprox_meta=warcprox_meta, status=prox_rec_res.status, size=prox_rec_res.recorder.len, client_ip=self.client_address[0], - content_type=prox_rec_res.getheader("Content-Type"), + content_type=prox_rec_res.headers.get("Content-Type"), method=self.command, timestamp=timestamp, host=self.hostname, duration=datetime.datetime.utcnow()-timestamp) self.server.recorded_url_q.put(recorded_url)