Mitmproxy corrupts some jpeg images that pass thru it


Some of jpeg images get corrupted while passing thru mitmproxy, when trying to open the corrupted jpeg with an image viewer, i get the following error “Bogus Huffman table definition”

here is a piece of hex codes of both images compared:

HEX on the right is a working JPEG fromthe original source, HEX on the left is corrupted JPEG from mitmproxy.

Maybe somebody will be able to figure out what the issue is.