aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/contentview.py
diff options
context:
space:
mode:
Diffstat (limited to 'libmproxy/contentview.py')
-rw-r--r--libmproxy/contentview.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/libmproxy/contentview.py b/libmproxy/contentview.py
index 45c1f2f1..a9b6cf95 100644
--- a/libmproxy/contentview.py
+++ b/libmproxy/contentview.py
@@ -9,14 +9,13 @@ import lxml.html
import lxml.etree
from PIL import Image
from PIL.ExifTags import TAGS
-import urwid
import html2text
import netlib.utils
-from netlib import odict, encoding
from . import utils
from .contrib import jsbeautifier
from .contrib.wbxml.ASCommandResponse import ASCommandResponse
+from netlib import encoding
try:
import pyamf
@@ -129,7 +128,7 @@ class ViewAuto(View):
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])
@@ -536,7 +535,7 @@ def get(name):
return i
-def get_content_view(viewmode, hdrItems, content, limit, is_request, log=None):
+def get_content_view(viewmode, headers, content, limit, is_request, log=None):
"""
Returns:
A (msg, body) tuple.
@@ -551,16 +550,14 @@ def get_content_view(viewmode, hdrItems, content, limit, is_request, log=None):
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:
if log:
@@ -569,7 +566,7 @@ def get_content_view(viewmode, hdrItems, content, limit, is_request, log=None):
log(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])