From 8eec21d553420c51635701c4b57e2df4ddc41890 Mon Sep 17 00:00:00 2001 From: Miroslav Date: Sat, 10 Feb 2018 20:29:38 +0200 Subject: [PATCH] Fix reverting of a flow --- mitmproxy/addons/core.py | 1 + mitmproxy/tools/console/consoleaddons.py | 1 + 2 files changed, 2 insertions(+) diff --git a/mitmproxy/addons/core.py b/mitmproxy/addons/core.py index 2b0b2f141..fb46f243a 100644 --- a/mitmproxy/addons/core.py +++ b/mitmproxy/addons/core.py @@ -178,6 +178,7 @@ class Core: for f in flows: p = getattr(f, part, None) if p: + f.backup() current_enc = p.headers.get("content-encoding", "identity") if current_enc == "identity": p.encode("deflate") diff --git a/mitmproxy/tools/console/consoleaddons.py b/mitmproxy/tools/console/consoleaddons.py index 5907fe95a..deaf016d1 100644 --- a/mitmproxy/tools/console/consoleaddons.py +++ b/mitmproxy/tools/console/consoleaddons.py @@ -383,6 +383,7 @@ class ConsoleAddon: part in ("response-headers", "response-body", "set-cookies") and flow.response is None ) + flow.backup() if require_dummy_response: flow.response = http.HTTPResponse.make() if part == "cookies":