aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/console/flowview.py
diff options
context:
space:
mode:
Diffstat (limited to 'mitmproxy/console/flowview.py')
-rw-r--r--mitmproxy/console/flowview.py33
1 files changed, 17 insertions, 16 deletions
diff --git a/mitmproxy/console/flowview.py b/mitmproxy/console/flowview.py
index e9b23176..208b0d44 100644
--- a/mitmproxy/console/flowview.py
+++ b/mitmproxy/console/flowview.py
@@ -176,7 +176,7 @@ class FlowView(tabs.Tabs):
self.show()
def content_view(self, viewmode, message):
- if message.content is None:
+ if message.raw_content is None:
msg, body = "", [urwid.Text([("error", "[content missing]")])]
return msg, body
else:
@@ -214,6 +214,12 @@ class FlowView(tabs.Tabs):
)
description = description.replace("Raw", "Couldn't parse: falling back to Raw")
+ if message.content != message.raw_content:
+ description = "[decoded {enc}] {desc}".format(
+ enc=message.headers.get("content-encoding"),
+ desc=description
+ )
+
# Give hint that you have to tab for the response.
if description == "No content" and isinstance(message, models.HTTPRequest):
description = "No request content (press tab to view response)"
@@ -407,15 +413,14 @@ class FlowView(tabs.Tabs):
)
)
if part == "r":
- with models.decoded(message):
- # Fix an issue caused by some editors when editing a
- # request/response body. Many editors make it hard to save a
- # file without a terminating newline on the last line. When
- # editing message bodies, this can cause problems. For now, I
- # just strip the newlines off the end of the body when we return
- # from an editor.
- c = self.master.spawn_editor(message.content or "")
- message.content = c.rstrip("\n")
+ # Fix an issue caused by some editors when editing a
+ # request/response body. Many editors make it hard to save a
+ # file without a terminating newline on the last line. When
+ # editing message bodies, this can cause problems. For now, I
+ # just strip the newlines off the end of the body when we return
+ # from an editor.
+ c = self.master.spawn_editor(message.content or b"")
+ message.content = c.rstrip(b"\n")
elif part == "f":
if not message.urlencoded_form and message.content:
signals.status_prompt_onekey.send(
@@ -512,14 +517,10 @@ class FlowView(tabs.Tabs):
signals.flow_change.send(self, flow = self.flow)
def delete_body(self, t):
- if t == "m":
- val = None
- else:
- val = None
if self.tab_offset == TAB_REQ:
- self.flow.request.content = val
+ self.flow.request.content = None
else:
- self.flow.response.content = val
+ self.flow.response.content = None
signals.flow_change.send(self, flow = self.flow)
def keypress(self, size, key):