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 /examples/stub.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 'examples/stub.py')
-rw-r--r-- | examples/stub.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/examples/stub.py b/examples/stub.py index f235ea85..119298fc 100644 --- a/examples/stub.py +++ b/examples/stub.py @@ -1,30 +1,31 @@ """ - This is a script stub, with empty definitions for all events. + This is a script stub, with definitions for all events. """ def start(ctx): """ Called once on script startup, before any other events. """ - pass + ctx.log("start") def clientconnect(ctx, client_connect): """ Called when a client initiates a connection to the proxy. Note that a connection can correspond to multiple HTTP requests """ - pass + ctx.log("clientconnect") def request(ctx, flow): """ Called when a client request has been received. """ + ctx.log("request") def response(ctx, flow): """ Called when a server response has been received. """ - pass + ctx.log("response") def error(ctx, flow): """ @@ -32,16 +33,16 @@ def error(ctx, flow): interrupted connections. This is distinct from a valid server HTTP error response, which is simply a response with an HTTP error code. """ - pass + ctx.log("error") def clientdisconnect(ctx, client_disconnect): """ Called when a client disconnects from the proxy. """ - pass + ctx.log("clientdisconnect") def done(ctx): """ Called once on script shutdown, after any other events. """ - pass + ctx.log("done") |