aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2016-09-30 12:13:49 +1000
committerAldo Cortesi <aldo@nullcube.com>2016-09-30 12:13:49 +1000
commit66825568d7e4640badfa77ebec4ee5e8b7317962 (patch)
treec82eb8807bac03c55bb0b15e762a26d06c2eb13a
parent6d1f036021cde61e42891091546a29612d7d9a45 (diff)
downloadmitmproxy-66825568d7e4640badfa77ebec4ee5e8b7317962.tar.gz
mitmproxy-66825568d7e4640badfa77ebec4ee5e8b7317962.tar.bz2
mitmproxy-66825568d7e4640badfa77ebec4ee5e8b7317962.zip
console: fix client replay
-rw-r--r--mitmproxy/builtins/clientplayback.py1
-rw-r--r--mitmproxy/console/master.py8
-rw-r--r--mitmproxy/console/window.py20
3 files changed, 13 insertions, 16 deletions
diff --git a/mitmproxy/builtins/clientplayback.py b/mitmproxy/builtins/clientplayback.py
index c40d1904..75ef2ffd 100644
--- a/mitmproxy/builtins/clientplayback.py
+++ b/mitmproxy/builtins/clientplayback.py
@@ -19,6 +19,7 @@ class ClientPlayback:
def configure(self, options, updated):
if "client_replay" in updated:
if options.client_replay:
+ ctx.log.info(options.client_replay)
try:
flows = flow.read_flows_from_paths(options.client_replay)
except exceptions.FlowReadException as e:
diff --git a/mitmproxy/console/master.py b/mitmproxy/console/master.py
index febf46c5..6652bf0c 100644
--- a/mitmproxy/console/master.py
+++ b/mitmproxy/console/master.py
@@ -635,14 +635,6 @@ class ConsoleMaster(flow.FlowMaster):
def edit_scripts(self, scripts):
self.options.scripts = [x[0] for x in scripts]
- def stop_client_playback_prompt(self, a):
- 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 urwid.ExitMainLoop
diff --git a/mitmproxy/console/window.py b/mitmproxy/console/window.py
index 159f68ed..ab2c80ad 100644
--- a/mitmproxy/console/window.py
+++ b/mitmproxy/console/window.py
@@ -40,13 +40,11 @@ class Window(urwid.Frame):
def handle_replay(self, k):
if k == "c":
- if not self.master.client_playback:
- signals.status_prompt_path.send(
- self,
- prompt = "Client replay path",
- callback = self.master.client_playback_path
- )
- else:
+ creplay = self.master.addons.get("clientplayback")
+ if self.master.options.client_replay and creplay.count():
+ def stop_client_playback_prompt(a):
+ if a != "n":
+ self.master.options.client_replay = None
signals.status_prompt_onekey.send(
self,
prompt = "Stop current client replay?",
@@ -54,7 +52,13 @@ class Window(urwid.Frame):
("yes", "y"),
("no", "n"),
),
- callback = self.master.stop_client_playback_prompt,
+ callback = stop_client_playback_prompt
+ )
+ else:
+ signals.status_prompt_path.send(
+ self,
+ prompt = "Client replay path",
+ callback = lambda x: self.master.options.setter("client_replay")([x])
)
elif k == "s":
a = self.master.addons.get("serverplayback")