mirror of
https://github.com/zhigang1992/mitmproxy.git
synced 2026-04-24 04:14:57 +08:00
Refine encoding support
- Push decoding down into the LRU cache - Cope gracefully with corrupted data and incorrect encoding headers
This commit is contained in:
@@ -18,11 +18,13 @@ class udecode_gzip(libpry.AutoTree):
|
||||
gf.write('string')
|
||||
gf.close()
|
||||
assert 'string' == encoding.decode('gzip', s.getvalue())
|
||||
assert None == encoding.decode("gzip", "bogus")
|
||||
|
||||
class udecode_deflate(libpry.AutoTree):
|
||||
def test_simple(self):
|
||||
assert 'string' == encoding.decode('deflate', zlib.compress('string'))
|
||||
assert 'string' == encoding.decode('deflate', zlib.compress('string')[2:-4])
|
||||
assert None == encoding.decode("deflate", "bogus")
|
||||
|
||||
tests = [
|
||||
udecode_identity(),
|
||||
|
||||
Reference in New Issue
Block a user