Skip to content

KeyError: 'sdch, gzip' #2246

Open
Open

Description

@Mradr
Steps to reproduce the problem:

1: #----------------------------------------------------------------------
def response(self, flow):
# Gather outgoing data size
if flow.response.content:
self.outgoing_data_size += len(flow.response.raw_content)
2. Go to google.com and search "test"
3. Red text flys by saying:
Script error: Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/mitmproxy/net/http/encoding.py", line 48, in decode
decoded = custom_decodeencoding
KeyError: 'sdch, gzip'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/mitmproxy/net/http/encoding.py", line 50, in decode
decoded = codecs.decode(encoded, encoding, errors)
LookupError: unknown encoding: sdch, gzip

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 791, in response
if flow.response.content:
File "/usr/local/lib/python3.5/dist-packages/mitmproxy/net/http/message.py", line 97, in get_content
content = encoding.decode(self.raw_content, ce)
File "/usr/local/lib/python3.5/dist-packages/mitmproxy/net/http/encoding.py", line 61, in decode
repr(e),
ValueError: LookupError when decoding b'\x1f\x8b with 'sdch, gzip': LookupError('unknown encoding: sdch, gzip',)

Any other comments? What have you tried so far?

Looks like gzip is supported, but I don't see anything about sdch. Looks to be missing

Activity

  1. mhils commented on Apr 21, 2017

    @mhils
    Member

    Now that's a bit confusing - my understanding is that the Content-Encoding header names the agreed-on encoding, so it shouldn't be a list. Can you share a mitmproxy dump file with a flow that has this issue?

  2. added
    kind/triage
    on Apr 21, 2017
  3. Mradr commented on Apr 22, 2017

    @Mradr
    Author

    untitled

    Maybe not what you are looking for. Sorry, but willing to work to report this issue. Just let me know "where" you want me to get images or log files at.
    untitled

  4. mhils commented on Apr 26, 2017

    @mhils
    Member

    Thanks.

    @cortesi: is it right that we do not call request.constrain_encoding() on flows by default?

  5. added and removed
    kind/triage
    on Oct 25, 2017
  6. mhils commented on Oct 25, 2017

    @mhils
    Member

    Pretty sure this is an error and we should do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions