I'm trying to edit the content of a Request in mitmproxy and pass it over, but the content of the body is encoded by gzip. I can see the structure of data which is like xml, but I cannot edit it and save it in gzip format. How can I resolve this issue? I tried different tutorials, but none of them are going into detail in that level
1 Answers
I was not able to get this to work using mitmproxy 0.11.1, because every time I tried to edit the response, the body would open in my text editor as the raw gzipped source. However, it did work in mitmproxy 0.11.3. Unfortunately, there appear to be no release notes for the 0.11.2 or 0.11.3 releases.
I set up an i ~bs
(response body) intercept hook, and a l ~bs
filter to display the intercepted message. I loaded the page in a browser, opened the request, pressed tab to view the response body, hit e
to edit, and r
for raw body. That opened my editor with the body response as unformatted ASCII text, not the raw gzipped encoding. After saving a one-character change and exiting the editor, I hit a
to accept and send the updated message, and saw the change in the web browser developer tools.
However, on several other occasions while doing this and changing a lot of characters in the response body, mitmproxy crashed.

- 12,947
- 6
- 68
- 71
-
1While researching, I found [this old reply about gzipped bodies from the author of mitmproxy](https://groups.google.com/forum/#!topic/mitmproxy/wLUTY7haQVw). It no longer seems relevant, as it was clear from the reply that mitmproxy is intended to be able to intercept and change gzipped reply bodies. – Steve HHH Jan 16 '15 at 00:35