aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2018-02-13 20:08:35 +0100
committerGitHub <noreply@github.com>2018-02-13 20:08:35 +0100
commitb689f48f7f3896414821fe617932ce4792939dc3 (patch)
tree59e56a5c78a5f7cb66072bc0cd1526d6e7aeea21
parent9751f0695ded0c59097dda6768d31effdcaf0968 (diff)
parentf21979f6ad4da5d184cc1898d6e139712a91ab0d (diff)
downloadmitmproxy-b689f48f7f3896414821fe617932ce4792939dc3.tar.gz
mitmproxy-b689f48f7f3896414821fe617932ce4792939dc3.tar.bz2
mitmproxy-b689f48f7f3896414821fe617932ce4792939dc3.zip
Merge pull request #2858 from kajojify/revert_flow
Fix reverting of a flow
-rw-r--r--mitmproxy/addons/core.py3
-rw-r--r--mitmproxy/tools/console/consoleaddons.py2
2 files changed, 5 insertions, 0 deletions
diff --git a/mitmproxy/addons/core.py b/mitmproxy/addons/core.py
index 2b0b2f14..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)
@@ -178,6 +179,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")
@@ -204,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 aa46501b..03f2e240 100644
--- a/mitmproxy/tools/console/consoleaddons.py
+++ b/mitmproxy/tools/console/consoleaddons.py
@@ -390,6 +390,8 @@ 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