diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2011-08-05 14:03:10 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2011-08-05 14:08:03 +1200 |
commit | f23818ceeaac88f266674ea518878a17a74a1d16 (patch) | |
tree | 5882404b6da8e5853e559cadf908836cd664384b /libmproxy/console.py | |
parent | cd0e2f18e6626f5d02ab749a001934a016eee966 (diff) | |
download | mitmproxy-f23818ceeaac88f266674ea518878a17a74a1d16.tar.gz mitmproxy-f23818ceeaac88f266674ea518878a17a74a1d16.tar.bz2 mitmproxy-f23818ceeaac88f266674ea518878a17a74a1d16.zip |
Add a "done" event for scripts.
Called exactly once after all other events.
Diffstat (limited to 'libmproxy/console.py')
-rw-r--r-- | libmproxy/console.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libmproxy/console.py b/libmproxy/console.py index a6501cc1..4ee4018f 100644 --- a/libmproxy/console.py +++ b/libmproxy/console.py @@ -964,12 +964,6 @@ class ConsoleMaster(flow.FlowMaster): print >> sys.stderr, "Sticky auth error:", r sys.exit(1) - if options.script: - err = self.load_script(options.script) - if err: - print >> sys.stderr, "Script load error:", r - sys.exit(1) - self.refresh_server_playback = options.refresh_server_playback self.anticache = options.anticache self.anticomp = options.anticomp @@ -987,6 +981,13 @@ class ConsoleMaster(flow.FlowMaster): self.debug = options.debug + if options.script: + err = self.load_script(options.script) + if err: + print >> sys.stderr, "Script load error:", err + sys.exit(1) + + def run_script_once(self, path, f): ret = self.get_script(path) if ret[0]: @@ -999,6 +1000,7 @@ class ConsoleMaster(flow.FlowMaster): s.run("response", f) if f.error: s.run("error", f) + s.run("done") self.refresh_connection(f) self.state.last_script = path @@ -1660,7 +1662,7 @@ class ConsoleMaster(flow.FlowMaster): k = None elif k == "s": if self.script: - self.script = None + self.load_script(None) else: self.path_prompt( "Set script: ", |