diff options
Diffstat (limited to 'libmproxy/encoding.py')
-rw-r--r-- | libmproxy/encoding.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libmproxy/encoding.py b/libmproxy/encoding.py index aab4141b..6886fb0b 100644 --- a/libmproxy/encoding.py +++ b/libmproxy/encoding.py @@ -8,21 +8,25 @@ __ALL__ = ["ENCODINGS"] ENCODINGS = set(["identity", "gzip", "deflate"]) -def decode(encoding, content): +def decode(e, content): encoding_map = { "identity": identity, "gzip": decode_gzip, "deflate": decode_deflate, } - return encoding_map.get(encoding, identity)(content) + if e not in encoding_map: + return None + return encoding_map[e](content) -def encode(encoding, content): +def encode(e, content): encoding_map = { "identity": identity, "gzip": encode_gzip, "deflate": encode_deflate, } - return encoding_map.get(encoding, identity)(content) + if e not in encoding_map: + return None + return encoding_map[e](content) def identity(content): """ |