diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-07-04 13:58:09 -0700 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-07-04 13:58:09 -0700 |
commit | a6b3551934e2b8768177d6831ca08f97f5bdae44 (patch) | |
tree | 39fd8a2223b726b7b496b93ed55ade32e9ebf05e /mitmproxy/dump.py | |
parent | 2f8a1fd2cb1374941f436f36bbfa0d0b3d9213c7 (diff) | |
download | mitmproxy-a6b3551934e2b8768177d6831ca08f97f5bdae44.tar.gz mitmproxy-a6b3551934e2b8768177d6831ca08f97f5bdae44.tar.bz2 mitmproxy-a6b3551934e2b8768177d6831ca08f97f5bdae44.zip |
raise ValueError if content-encoding is invalid
Diffstat (limited to 'mitmproxy/dump.py')
-rw-r--r-- | mitmproxy/dump.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/mitmproxy/dump.py b/mitmproxy/dump.py index ea242bba..0a9b76a7 100644 --- a/mitmproxy/dump.py +++ b/mitmproxy/dump.py @@ -187,15 +187,20 @@ class DumpMaster(flow.FlowMaster): ) self.echo(headers, indent=4) if self.o.flow_detail >= 3: - if message.content is None: + try: + content = message.content + except ValueError: + content = message.raw_content + + if content is None: self.echo("(content missing)", indent=4) - elif message.content: + elif content: self.echo("") try: type, lines = contentviews.get_content_view( contentviews.get("Auto"), - message.content, + content, headers=getattr(message, "headers", None) ) except exceptions.ContentViewException: @@ -203,7 +208,7 @@ class DumpMaster(flow.FlowMaster): self.add_event(s, "debug") type, lines = contentviews.get_content_view( contentviews.get("Raw"), - message.content, + content, headers=getattr(message, "headers", None) ) |