Client playback shortcut in mitmproxy can now be used to interrupt a current client playback.

This commit is contained in:
Aldo Cortesi 2011-03-18 09:38:51 +13:00
parent 4893e5e5a4
commit f97c144869
2 changed files with 23 additions and 5 deletions

View File

@ -1298,11 +1298,22 @@ class ConsoleMaster(flow.FlowMaster):
if k == "?":
self.view_help()
elif k == "c":
if not self.client_playback:
self.path_prompt(
"Client replay: ",
self.state.last_saveload,
self.client_playback_path
)
else:
self.prompt_onekey(
"Stop current client replay?",
(
("yes", "y"),
("no", "n"),
),
self.stop_client_playback_prompt,
)
k = None
elif k == "l":
self.prompt("Limit: ", self.state.limit_txt, self.set_limit)
@ -1384,6 +1395,10 @@ class ConsoleMaster(flow.FlowMaster):
except (Stop, KeyboardInterrupt):
pass
def stop_client_playback_prompt(self, a):
if a != "n":
self.stop_client_playback()
def quit(self, a):
if a != "n":
raise Stop

View File

@ -464,6 +464,9 @@ class FlowMaster(controller.Master):
"""
self.client_playback = ClientPlaybackState(flows, exit)
def stop_client_playback(self):
self.client_playback = None
def start_server_playback(self, flows, kill, headers, exit):
"""
flows: A list of flows.