diff options
author | Maximilian Hils <git@maximilianhils.com> | 2017-12-12 14:41:26 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2017-12-12 16:46:35 +0100 |
commit | 8e9194c2b4b8c1b82832cdab1b364f3300e2d3fd (patch) | |
tree | dcdcac7167df3c8150161deecb6fa7ba34cb313b | |
parent | 4d924dcfe2cca8c7adf1dcd9ca6aca54a6065d26 (diff) | |
download | mitmproxy-8e9194c2b4b8c1b82832cdab1b364f3300e2d3fd.tar.gz mitmproxy-8e9194c2b4b8c1b82832cdab1b364f3300e2d3fd.tar.bz2 mitmproxy-8e9194c2b4b8c1b82832cdab1b364f3300e2d3fd.zip |
fix #2529
-rw-r--r-- | mitmproxy/flow.py | 6 | ||||
-rw-r--r-- | test/mitmproxy/test_http.py | 9 |
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" |