aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mitmproxy/flow.py6
-rw-r--r--test/mitmproxy/test_http.py9
2 files changed, 13 insertions, 2 deletions
diff --git a/mitmproxy/flow.py b/mitmproxy/flow.py
index dc778404..111566b8 100644
--- a/mitmproxy/flow.py
+++ b/mitmproxy/flow.py
@@ -179,5 +179,7 @@ class Flow(stateobject.StateObject):
if not self.intercepted:
return
self.intercepted = False
- self.reply.ack()
- self.reply.commit()
+ # If a flow is intercepted and then duplicated, the duplicated one is not taken.
+ if self.reply.state == "taken":
+ self.reply.ack()
+ self.reply.commit()
diff --git a/test/mitmproxy/test_http.py b/test/mitmproxy/test_http.py
index 4463961a..49e61e25 100644
--- a/test/mitmproxy/test_http.py
+++ b/test/mitmproxy/test_http.py
@@ -203,6 +203,15 @@ class TestHTTPFlow:
f.resume()
assert f.reply.state == "committed"
+ def test_resume_duplicated(self):
+ f = tflow.tflow()
+ f.intercept()
+ f2 = f.copy()
+ assert f.intercepted is f2.intercepted is True
+ f.resume()
+ f2.resume()
+ assert f.intercepted is f2.intercepted is False
+
def test_replace_unicode(self):
f = tflow.tflow(resp=True)
f.response.content = b"\xc2foo"