aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/console/flowview.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2015-09-05 20:45:58 +0200
committerMaximilian Hils <git@maximilianhils.com>2015-09-05 20:45:58 +0200
commit5125c669ccd2db5de5f90c66db61e64f63f3ba4c (patch)
tree6773ffcaada096f7e02c54665b733c1bad350e98 /libmproxy/console/flowview.py
parent00561d280ccd4aac06b13b434e0aef4492148cb5 (diff)
downloadmitmproxy-5125c669ccd2db5de5f90c66db61e64f63f3ba4c.tar.gz
mitmproxy-5125c669ccd2db5de5f90c66db61e64f63f3ba4c.tar.bz2
mitmproxy-5125c669ccd2db5de5f90c66db61e64f63f3ba4c.zip
adjust to new netlib Headers class
Diffstat (limited to 'libmproxy/console/flowview.py')
-rw-r--r--libmproxy/console/flowview.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/libmproxy/console/flowview.py b/libmproxy/console/flowview.py
index 8b828653..19917555 100644
--- a/libmproxy/console/flowview.py
+++ b/libmproxy/console/flowview.py
@@ -4,7 +4,7 @@ import sys
import urwid
from netlib import odict
-from netlib.http.semantics import CONTENT_MISSING
+from netlib.http.semantics import CONTENT_MISSING, Headers
from . import common, grideditor, contentview, signals, searchable, tabs
from . import flowdetailview
@@ -182,7 +182,7 @@ class FlowView(tabs.Tabs):
description, text_objects = cache.get(
contentview.get_content_view,
viewmode,
- tuple(tuple(i) for i in conn.headers.lst),
+ conn.headers,
conn.content,
limit,
isinstance(conn, HTTPRequest)
@@ -199,7 +199,7 @@ class FlowView(tabs.Tabs):
def conn_text(self, conn):
if conn:
txt = common.format_keyvals(
- [(h + ":", v) for (h, v) in conn.headers.lst],
+ [(h + ":", v) for (h, v) in conn.headers.fields],
key = "header",
val = "text"
)
@@ -284,8 +284,8 @@ class FlowView(tabs.Tabs):
response.msg = msg
signals.flow_change.send(self, flow = self.flow)
- def set_headers(self, lst, conn):
- conn.headers = odict.ODictCaseless(lst)
+ def set_headers(self, fields, conn):
+ conn.headers = Headers(fields)
signals.flow_change.send(self, flow = self.flow)
def set_query(self, lst, conn):
@@ -330,7 +330,7 @@ class FlowView(tabs.Tabs):
if not self.flow.response:
self.flow.response = HTTPResponse(
self.flow.request.httpversion,
- 200, "OK", odict.ODictCaseless(), ""
+ 200, "OK", Headers(), ""
)
self.flow.response.reply = controller.DummyReply()
message = self.flow.response
@@ -381,7 +381,7 @@ class FlowView(tabs.Tabs):
self.master.view_grideditor(
grideditor.HeaderEditor(
self.master,
- message.headers.lst,
+ message.headers.fields,
self.set_headers,
message
)
@@ -616,8 +616,7 @@ class FlowView(tabs.Tabs):
key = None
elif key == "v":
if conn.content:
- t = conn.headers["content-type"] or [None]
- t = t[0]
+ t = conn.headers.get("content-type")
if "EDITOR" in os.environ or "PAGER" in os.environ:
self.master.spawn_external_viewer(conn.content, t)
else:
@@ -626,7 +625,7 @@ class FlowView(tabs.Tabs):
)
elif key == "z":
self.flow.backup()
- e = conn.headers.get_first("content-encoding", "identity")
+ e = conn.headers.get("content-encoding", "identity")
if e != "identity":
if not conn.decode():
signals.status_message.send(