diff options
author | Maximilian Hils <git@maximilianhils.com> | 2018-01-11 13:25:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-11 13:25:07 +0100 |
commit | daecd50c5a04f329da622812dc561cfa99decd91 (patch) | |
tree | dbe2c1bdd00a636c7eed0089a4b7b164ff7d1cd1 | |
parent | 67300fab3119f055a6cbb43b7cbc9d33e849d165 (diff) | |
parent | 137a78f22a91f7da7f51a62e0d616e6dc5adf7ea (diff) | |
download | mitmproxy-daecd50c5a04f329da622812dc561cfa99decd91.tar.gz mitmproxy-daecd50c5a04f329da622812dc561cfa99decd91.tar.bz2 mitmproxy-daecd50c5a04f329da622812dc561cfa99decd91.zip |
Merge pull request #2781 from MatthewShao/fix#2766
Fix #2766.
-rw-r--r-- | mitmproxy/addons/clientplayback.py | 3 | ||||
-rw-r--r-- | test/mitmproxy/addons/test_clientplayback.py | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/mitmproxy/addons/clientplayback.py b/mitmproxy/addons/clientplayback.py index 3fd96669..2dd488b9 100644 --- a/mitmproxy/addons/clientplayback.py +++ b/mitmproxy/addons/clientplayback.py @@ -35,6 +35,9 @@ class ClientPlayback: """ Replay requests from flows. """ + for f in flows: + if f.live: + raise exceptions.CommandError("Can't replay live flow.") self.flows = list(flows) ctx.log.alert("Replaying %s flows." % len(self.flows)) ctx.master.addons.trigger("update", []) diff --git a/test/mitmproxy/addons/test_clientplayback.py b/test/mitmproxy/addons/test_clientplayback.py index 2dc7eb92..3f990668 100644 --- a/test/mitmproxy/addons/test_clientplayback.py +++ b/test/mitmproxy/addons/test_clientplayback.py @@ -52,6 +52,10 @@ class TestClientPlayback: cp.stop_replay() assert not cp.flows + df = tflow.DummyFlow(tflow.tclient_conn(), tflow.tserver_conn(), True) + with pytest.raises(exceptions.CommandError, match="Can't replay live flow."): + cp.start_replay([df]) + def test_load_file(self, tmpdir): cp = clientplayback.ClientPlayback() with taddons.context(): |