diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-09-06 01:37:19 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-09-06 01:37:19 +0200 |
commit | eb2334c6cb7c9ab9c260bc609ae43fb53d441f6f (patch) | |
tree | a6b263b856bd035ac154b45fe7e91706918b25f3 /libmproxy/console/contentview.py | |
parent | 853cd810757a02252402da22ae77cab77c5a3fb6 (diff) | |
parent | a8d931089c9ecf450b69321706825cf694c1c08e (diff) | |
download | mitmproxy-eb2334c6cb7c9ab9c260bc609ae43fb53d441f6f.tar.gz mitmproxy-eb2334c6cb7c9ab9c260bc609ae43fb53d441f6f.tar.bz2 mitmproxy-eb2334c6cb7c9ab9c260bc609ae43fb53d441f6f.zip |
Merge branch 'master' into readthedocs
Diffstat (limited to 'libmproxy/console/contentview.py')
-rw-r--r-- | libmproxy/console/contentview.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/libmproxy/console/contentview.py b/libmproxy/console/contentview.py index 95ea7b17..17ed90e1 100644 --- a/libmproxy/console/contentview.py +++ b/libmproxy/console/contentview.py @@ -12,7 +12,7 @@ import urwid import html2text import netlib.utils -from netlib import odict, encoding +from netlib import encoding from . import common, signals from .. import utils @@ -74,7 +74,7 @@ class ViewAuto: content_types = [] def __call__(self, hdrs, content, limit): - ctype = hdrs.get_first("content-type") + ctype = hdrs.get("content-type") if ctype: ct = netlib.utils.parse_content_type(ctype) if ctype else None ct = "%s/%s" % (ct[0], ct[1]) @@ -508,7 +508,7 @@ def get(name): return i -def get_content_view(viewmode, hdrItems, content, limit, is_request): +def get_content_view(viewmode, headers, content, limit, is_request): """ Returns a (msg, body) tuple. """ @@ -519,16 +519,14 @@ def get_content_view(viewmode, hdrItems, content, limit, is_request): return "No content", "" msg = [] - hdrs = odict.ODictCaseless([list(i) for i in hdrItems]) - - enc = hdrs.get_first("content-encoding") + enc = headers.get("content-encoding") if enc and enc != "identity": decoded = encoding.decode(enc, content) if decoded: content = decoded msg.append("[decoded %s]" % enc) try: - ret = viewmode(hdrs, content, limit) + ret = viewmode(headers, content, limit) # Third-party viewers can fail in unexpected ways... except Exception: s = traceback.format_exc() @@ -536,7 +534,7 @@ def get_content_view(viewmode, hdrItems, content, limit, is_request): signals.add_event(s, "error") ret = None if not ret: - ret = get("Raw")(hdrs, content, limit) + ret = get("Raw")(headers, content, limit) msg.append("Couldn't parse: falling back to Raw") else: msg.append(ret[0]) |