diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2011-03-18 09:43:47 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2011-03-18 09:43:47 +1300 |
commit | 89b0ac51952e62abc61123a4c6e766c671f0ac86 (patch) | |
tree | b4aad19bed75c7a09adda98460b2d5218e4256b1 /libmproxy | |
parent | f97c144869fa4cb8123d0a12ec9503ee0a8cf485 (diff) | |
download | mitmproxy-89b0ac51952e62abc61123a4c6e766c671f0ac86.tar.gz mitmproxy-89b0ac51952e62abc61123a4c6e766c671f0ac86.tar.bz2 mitmproxy-89b0ac51952e62abc61123a4c6e766c671f0ac86.zip |
Server replay shortcut in mitmproxy can now be used to interrupt a current replay.
Diffstat (limited to 'libmproxy')
-rw-r--r-- | libmproxy/console.py | 24 | ||||
-rw-r--r-- | libmproxy/flow.py | 3 |
2 files changed, 22 insertions, 5 deletions
diff --git a/libmproxy/console.py b/libmproxy/console.py index 4c53ef01..b8f766e6 100644 --- a/libmproxy/console.py +++ b/libmproxy/console.py @@ -1359,11 +1359,21 @@ class ConsoleMaster(flow.FlowMaster): ) k = None elif k == "s": - self.path_prompt( - "Server replay: ", - self.state.last_saveload, - self.server_playback_path - ) + if not self.server_playback: + self.path_prompt( + "Server replay: ", + self.state.last_saveload, + self.server_playback_path + ) + else: + self.prompt_onekey( + "Stop current server replay?", + ( + ("yes", "y"), + ("no", "n"), + ), + self.stop_server_playback_prompt, + ) k = None elif k == "L": self.path_prompt( @@ -1399,6 +1409,10 @@ class ConsoleMaster(flow.FlowMaster): if a != "n": self.stop_client_playback() + def stop_server_playback_prompt(self, a): + if a != "n": + self.stop_server_playback() + def quit(self, a): if a != "n": raise Stop diff --git a/libmproxy/flow.py b/libmproxy/flow.py index ea5e6cb8..718a3dcd 100644 --- a/libmproxy/flow.py +++ b/libmproxy/flow.py @@ -475,6 +475,9 @@ class FlowMaster(controller.Master): self.server_playback = ServerPlaybackState(headers, flows, exit) self.kill_nonreplay = kill + def stop_server_playback(self): + self.server_playback = None + def do_server_playback(self, flow): """ This method should be called by child classes in the handle_request |