Problem Description
GZIP requests are not decoded correctly.
This only occurs in the request and not in the response. In the response I see the body as uncompromised gzip but not in the request.
I created a own content view to test the gzip decompression:
from typing import Optional
from mitmproxy import contentviews, flow
from mitmproxy import http
import gzip
class ViewGZIPCase(contentviews.View):
name = "GZIP"
def __call__(self, data, **metadata) -> contentviews.TViewResult:
return "gzip", contentviews.format_text(gzip.decompress(data))
def render_priority(
self,
data: bytes,
*,
content_type: Optional[str] = None,
flow: Optional[flow.Flow] = None,
http_message: Optional[http.Message] = None,
**unknown_metadata,
) -> float:
if http_message.headers["content-encoding"] == "GZIP":
return 1
else:
return 0
view = ViewGZIPCase()
def load(l):
contentviews.add(view)
def done():
contentviews.remove(view)
request
with selected self-made view

without any special view

response
Mitmproxy standalone decompression and json parsing in the response but why not in the request?

Steps to reproduce the behavior:
- start Mitmproxy
- wait for requests ( iPhone 12 as client is connected)
- open the request
System Information
Mitmproxy: 7.0.2
Python: 3.9.6
OpenSSL: OpenSSL 1.1.1k 25 Mar 2021
Platform: macOS-11.5.1-x86_64-i386-64bit
Problem Description
GZIP requests are not decoded correctly.
This only occurs in the request and not in the response. In the response I see the body as uncompromised gzip but not in the request.
I created a own content view to test the gzip decompression:
request
with selected self-made view

without any special view

response
Mitmproxy standalone decompression and json parsing in the response but why not in the request?

Steps to reproduce the behavior:
System Information
Mitmproxy: 7.0.2
Python: 3.9.6
OpenSSL: OpenSSL 1.1.1k 25 Mar 2021
Platform: macOS-11.5.1-x86_64-i386-64bit