aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/console.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2011-07-14 15:59:27 +1200
committerAldo Cortesi <aldo@nullcube.com>2011-07-14 16:01:54 +1200
commit1c9e7b982a7d3fe76f5bd03e53b21b9d450f4607 (patch)
treed8280341e1f23bce216c934398bf0079d85de444 /libmproxy/console.py
parentb6e1bf63c3bb49e7515807e6b36dc3116b565f67 (diff)
downloadmitmproxy-1c9e7b982a7d3fe76f5bd03e53b21b9d450f4607.tar.gz
mitmproxy-1c9e7b982a7d3fe76f5bd03e53b21b9d450f4607.tar.bz2
mitmproxy-1c9e7b982a7d3fe76f5bd03e53b21b9d450f4607.zip
Rewrite Headers object to preserve order and case.
Diffstat (limited to 'libmproxy/console.py')
-rw-r--r--libmproxy/console.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/libmproxy/console.py b/libmproxy/console.py
index d99dd8ac..ffe37fc3 100644
--- a/libmproxy/console.py
+++ b/libmproxy/console.py
@@ -93,7 +93,7 @@ def format_flow(f, focus, extended=False, padding=2):
txt.append(("goodcode", str(f.response.code)))
else:
txt.append(("error", str(f.response.code)))
- t = f.response.headers.get("content-type")
+ t = f.response.headers["content-type"]
if t:
t = t[0].split(";")[0]
txt.append(("text", " %s"%t))
@@ -295,7 +295,11 @@ class ConnectionView(WWrap):
def _conn_text(self, conn, viewmode):
if conn:
- return self.master._cached_conn_text(conn.content, tuple(conn.headers.itemPairs()), viewmode)
+ return self.master._cached_conn_text(
+ conn.content,
+ tuple([tuple(i) for i in conn.headers.lst]),
+ viewmode
+ )
else:
return urwid.ListBox([])
@@ -485,7 +489,7 @@ class ConnectionView(WWrap):
else:
conn = self.flow.response
if conn.content:
- t = conn.headers.get("content-type", [None])
+ t = conn.headers["content-type"] or [None]
t = t[0]
self.master.spawn_external_viewer(conn.content, t)
elif key == "b":