mirror of
https://github.com/zhigang1992/mitmproxy.git
synced 2026-05-07 00:41:49 +08:00
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.
This commit is contained in:
@@ -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):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user