aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/console/flowview.py
diff options
context:
space:
mode:
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 958ab176..e33d4c43 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, 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),
@@ -200,7 +200,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"
)
@@ -285,8 +285,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):
@@ -331,7 +331,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
@@ -382,7 +382,7 @@ class FlowView(tabs.Tabs):
self.master.view_grideditor(
grideditor.HeaderEditor(
self.master,
- message.headers.lst,
+ message.headers.fields,
self.set_headers,
message
)
@@ -617,8 +617,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:
@@ -627,7 +626,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(