You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add on-the-fly compression support for --save-stream-file #8286
When using mitmdump --save-stream-file to capture flows over long periods or high-traffic proxying, the resulting files can grow very large. There's no built-in way to compress them on the fly - users must compress after the fact, which doesn't work well with strftime-rotated files or disk space constraints during capture.
Proposal
Add a --set save_stream_compression=gz|bz2|xz option that compresses stream files on the fly. Optionally accepts a level (e.g. gz=9). On the read side, auto-detect compressed files via magic bytes so -r, view.flows.load, replay addons, and the Python API transparently read gz/bz2/xz files without any extra flags.
Alternatives
Infer compression from file extension (.gz) - rejected because this would be a breaking change if someone happens to use these extensions today for uncompressed files.
Post-hoc compression - wastes disk I/O and doesn't help with disk space constraints during capture.
Additional context
I have a working implementation with tests ready to open as a PR.
I think this is a reasonable feature request overall, but the solution seems overengineered. Can we agree on one compression algorithm (zstandard?) without any configurability?
Activity
mhils commentedon Jul 17, 2026
I think this is a reasonable feature request overall, but the solution seems overengineered. Can we agree on one compression algorithm (zstandard?) without any configurability?
joelverhagen commentedon Jul 17, 2026
Sure! I don't have a strong feeling about which compression to use, although I found gzip worked by well for my own integration. I see zstd is in Python BCL starting 3.14 (https://peps.python.org/pep-0784/). Can we assume users of this feature will always have Python 3.14? I see in this:
mitmproxy/pyproject.toml
Line 5 in 99054d7
So I am thinking maybe the feature would have to be disabled for Python 3.12 and 3.13.
I'm happy to update the PR in this direction if it sounds right to you.
mhils commentedon Jul 17, 2026
We depend on the zstandard package already anyway. Let's use that, we can migrate everything to stdlib once we drop 3.13. :)
joelverhagen commentedon Jul 18, 2026
It is done.