aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/proxy.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2011-08-02 20:34:01 +1200
committerAldo Cortesi <aldo@nullcube.com>2011-08-02 20:42:46 +1200
commit8cc0469ee72592d079750a9d5427853d95a7dbfe (patch)
treeabbca7456a5321f26a0f5f45b820443a6bb292b0 /libmproxy/proxy.py
parentbb6ec29b186fdd482bae98e3fc33b71be5bf103e (diff)
downloadmitmproxy-8cc0469ee72592d079750a9d5427853d95a7dbfe.tar.gz
mitmproxy-8cc0469ee72592d079750a9d5427853d95a7dbfe.tar.bz2
mitmproxy-8cc0469ee72592d079750a9d5427853d95a7dbfe.zip
Tweak encoding behaviour
- Don't fail to identity encoding when an unknown encoding is specified. - Don't constrain encodings. I want to try to modify traffic as little as possible by default. - When decoding, delete content-encoding header rather than set it to "identity" - Refuse to decode/encode when there is an existing but unknown content-encoding header.
Diffstat (limited to 'libmproxy/proxy.py')
-rw-r--r--libmproxy/proxy.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py
index 0c142959..75c5bf8a 100644
--- a/libmproxy/proxy.py
+++ b/libmproxy/proxy.py
@@ -134,11 +134,14 @@ class HTTPMsg(controller.Msg):
Content-Encoding header and changing Content-Encoding header to
'identity'.
"""
+ ce = self.headers["content-encoding"]
+ if not ce or ce[0] not in encoding.ENCODINGS:
+ return
self.content = encoding.decode(
- (self.headers["content-encoding"] or ["identity"])[0],
+ ce[0],
self.content
)
- self.headers["content-encoding"] = ["identity"]
+ del self.headers["content-encoding"]
def encode(self, e):
"""