From f23818ceeaac88f266674ea518878a17a74a1d16 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Fri, 5 Aug 2011 14:03:10 +1200 Subject: Add a "done" event for scripts. Called exactly once after all other events. --- examples/stub.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'examples') 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") -- cgit v1.2.3