diff options
author | Miroslav <ttahabatt@gmail.com> | 2018-02-12 20:39:53 +0200 |
---|---|---|
committer | Miroslav <ttahabatt@gmail.com> | 2018-02-12 20:39:53 +0200 |
commit | f21979f6ad4da5d184cc1898d6e139712a91ab0d (patch) | |
tree | 04437c8bee22135a7a38f41de4f370f2d245864f | |
parent | 8eec21d553420c51635701c4b57e2df4ddc41890 (diff) | |
download | mitmproxy-f21979f6ad4da5d184cc1898d6e139712a91ab0d.tar.gz mitmproxy-f21979f6ad4da5d184cc1898d6e139712a91ab0d.tar.bz2 mitmproxy-f21979f6ad4da5d184cc1898d6e139712a91ab0d.zip |
backup for flow.decode/encode
-rw-r--r-- | mitmproxy/addons/core.py | 2 | ||||
-rw-r--r-- | mitmproxy/tools/console/consoleaddons.py | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/mitmproxy/addons/core.py b/mitmproxy/addons/core.py index fb46f243..ca21e1dc 100644 --- a/mitmproxy/addons/core.py +++ b/mitmproxy/addons/core.py @@ -164,6 +164,7 @@ class Core: for f in flows: p = getattr(f, part, None) if p: + f.backup() p.decode() updated.append(f) ctx.master.addons.trigger("update", updated) @@ -205,6 +206,7 @@ class Core: if p: current_enc = p.headers.get("content-encoding", "identity") if current_enc == "identity": + f.backup() p.encode(enc) updated.append(f) ctx.master.addons.trigger("update", updated) diff --git a/mitmproxy/tools/console/consoleaddons.py b/mitmproxy/tools/console/consoleaddons.py index deaf016d..7337473c 100644 --- a/mitmproxy/tools/console/consoleaddons.py +++ b/mitmproxy/tools/console/consoleaddons.py @@ -379,11 +379,12 @@ class ConsoleAddon: # but for now it is. if not flow: raise exceptions.CommandError("No flow selected.") + flow.backup() + require_dummy_response = ( 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": |