aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/flow.py
diff options
context:
space:
mode:
Diffstat (limited to 'libmproxy/flow.py')
-rw-r--r--libmproxy/flow.py10
1 files changed, 8 insertions, 2 deletions
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):
"""