2011-08-04 22:47:43 +00:00
|
|
|
"""
|
2011-08-05 02:03:10 +00:00
|
|
|
This is a script stub, with definitions for all events.
|
2011-08-04 22:47:43 +00:00
|
|
|
"""
|
2013-06-13 14:04:04 +00:00
|
|
|
def start(ctx, argv):
|
2011-08-04 22:47:43 +00:00
|
|
|
"""
|
|
|
|
Called once on script startup, before any other events.
|
|
|
|
"""
|
2011-08-05 02:03:10 +00:00
|
|
|
ctx.log("start")
|
2011-08-04 22:47:43 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
"""
|
2011-08-05 02:03:10 +00:00
|
|
|
ctx.log("clientconnect")
|
2011-08-04 22:47:43 +00:00
|
|
|
|
2013-12-16 21:10:06 +00:00
|
|
|
def serverconnect(ctx, server_connection):
|
|
|
|
"""
|
|
|
|
Called when the proxy initiates a connection to the target server. Note that a
|
|
|
|
connection can correspond to multiple HTTP requests
|
|
|
|
"""
|
|
|
|
ctx.log("serverconnect")
|
|
|
|
|
2011-08-04 22:47:43 +00:00
|
|
|
def request(ctx, flow):
|
|
|
|
"""
|
|
|
|
Called when a client request has been received.
|
|
|
|
"""
|
2011-08-05 02:03:10 +00:00
|
|
|
ctx.log("request")
|
2011-08-04 22:47:43 +00:00
|
|
|
|
|
|
|
def response(ctx, flow):
|
|
|
|
"""
|
|
|
|
Called when a server response has been received.
|
|
|
|
"""
|
2011-08-05 02:03:10 +00:00
|
|
|
ctx.log("response")
|
2011-08-04 22:47:43 +00:00
|
|
|
|
|
|
|
def error(ctx, flow):
|
|
|
|
"""
|
|
|
|
Called when a flow error has occured, e.g. invalid server responses, or
|
|
|
|
interrupted connections. This is distinct from a valid server HTTP error
|
2012-12-09 21:57:11 +00:00
|
|
|
response, which is simply a response with an HTTP error code.
|
2011-08-04 22:47:43 +00:00
|
|
|
"""
|
2011-08-05 02:03:10 +00:00
|
|
|
ctx.log("error")
|
2011-08-04 22:47:43 +00:00
|
|
|
|
|
|
|
def clientdisconnect(ctx, client_disconnect):
|
|
|
|
"""
|
|
|
|
Called when a client disconnects from the proxy.
|
|
|
|
"""
|
2011-08-05 02:03:10 +00:00
|
|
|
ctx.log("clientdisconnect")
|
2011-08-04 22:47:43 +00:00
|
|
|
|
|
|
|
def done(ctx):
|
|
|
|
"""
|
|
|
|
Called once on script shutdown, after any other events.
|
|
|
|
"""
|
2011-08-05 02:03:10 +00:00
|
|
|
ctx.log("done")
|