aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libmproxy/console/flowview.py3
-rw-r--r--libmproxy/flow.py10
2 files changed, 10 insertions, 3 deletions
diff --git a/libmproxy/console/flowview.py b/libmproxy/console/flowview.py
index 419bfbcd..61e8715b 100644
--- a/libmproxy/console/flowview.py
+++ b/libmproxy/console/flowview.py
@@ -576,7 +576,8 @@ class FlowView(common.WWrap):
self.flow.backup()
e = conn.headers.get_first("content-encoding", "identity")
if e != "identity":
- conn.decode()
+ if not conn.decode():
+ self.master.statusbar.message("Could not decode - invalid data?")
else:
self.master.prompt_onekey(
"Select encoding: ",
diff --git a/libmproxy/flow.py b/libmproxy/flow.py
index e5061dfb..c1d78be3 100644
--- a/libmproxy/flow.py
+++ b/libmproxy/flow.py
@@ -221,15 +221,21 @@ class HTTPMsg(StateObject):
Decodes content based on the current Content-Encoding header, then
removes the header. If there is no Content-Encoding header, no
action is taken.
+
+ Returns True if decoding succeeded, False otherwise.
"""
ce = self.headers.get_first("content-encoding")
if not self.content or ce not in encoding.ENCODINGS:
- return
- self.content = encoding.decode(
+ return False
+ data = encoding.decode(
ce,
self.content
)
+ if data is None:
+ return False
+ self.content = data
del self.headers["content-encoding"]
+ return True
def encode(self, e):
"""