diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2018-05-12 13:06:08 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2018-05-12 13:14:26 +1200 |
commit | 94428b2ffdcb5780a7a12373472b6a21eb9fd83e (patch) | |
tree | a5118f030786997e329fcb5986139e04998d7235 | |
parent | 33eba29d1e6801af1b2e067503a2f505be3f489b (diff) | |
download | mitmproxy-94428b2ffdcb5780a7a12373472b6a21eb9fd83e.tar.gz mitmproxy-94428b2ffdcb5780a7a12373472b6a21eb9fd83e.tar.bz2 mitmproxy-94428b2ffdcb5780a7a12373472b6a21eb9fd83e.zip |
script: tweak explicit command invocation
-rw-r--r-- | mitmproxy/addons/script.py | 11 | ||||
-rw-r--r-- | mitmproxy/net/tcp.py | 2 |
2 files changed, 5 insertions, 8 deletions
diff --git a/mitmproxy/addons/script.py b/mitmproxy/addons/script.py index 5c0fe2de..a39ce5ce 100644 --- a/mitmproxy/addons/script.py +++ b/mitmproxy/addons/script.py @@ -155,9 +155,9 @@ class ScriptLoader: if not os.path.isfile(path): ctx.log.error('No such script: %s' % path) return - try: - mod = load_script(path) - if mod: + mod = load_script(path) + if mod: + with addonmanager.safecall(): ctx.master.addons.invoke_addon(mod, "running") ctx.master.addons.invoke_addon( mod, @@ -166,10 +166,7 @@ class ScriptLoader: ) for f in flows: for evt, arg in eventsequence.iterate(f): - with addonmanager.safecall(): - ctx.master.addons.invoke_addon(mod, evt, arg) - except exceptions.OptionsError as e: - script_error_handler(path, e, msg=str(e)) + ctx.master.addons.invoke_addon(mod, evt, arg) def configure(self, updated): if "scripts" in updated: diff --git a/mitmproxy/net/tcp.py b/mitmproxy/net/tcp.py index 23284057..2496d47c 100644 --- a/mitmproxy/net/tcp.py +++ b/mitmproxy/net/tcp.py @@ -586,7 +586,7 @@ class TCPServer: with self.handler_counter: try: self.handle_client_connection(connection, client_address) - except OSError as e: + except OSError as e: # pragma: no cover # This catches situations where the underlying connection is # closed beneath us. Syscalls on the connection object at this # point returns EINVAL. If this happens, we close the socket and |