aboutsummaryrefslogtreecommitdiffstats
path: root/doc-src/scripting/inlinescripts.html
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2014-09-05 15:16:20 +0200
committerMaximilian Hils <git@maximilianhils.com>2014-09-05 15:16:20 +0200
commit2a6337343a14f7f72c28d8bf5f24220f6d9ca6d0 (patch)
tree755d8cf7f6578c9346e9f3c68604615177cf9332 /doc-src/scripting/inlinescripts.html
parentf2570c773aa18e4ac236b1cf7f43acfb4ca080dd (diff)
downloadmitmproxy-2a6337343a14f7f72c28d8bf5f24220f6d9ca6d0.tar.gz
mitmproxy-2a6337343a14f7f72c28d8bf5f24220f6d9ca6d0.tar.bz2
mitmproxy-2a6337343a14f7f72c28d8bf5f24220f6d9ca6d0.zip
update docs, mostly revert 2f44b26b4cd014e03dd62a125d79af9b81663a93
Diffstat (limited to 'doc-src/scripting/inlinescripts.html')
-rw-r--r--doc-src/scripting/inlinescripts.html53
1 files changed, 26 insertions, 27 deletions
diff --git a/doc-src/scripting/inlinescripts.html b/doc-src/scripting/inlinescripts.html
index 738f8dc3..eef4e440 100644
--- a/doc-src/scripting/inlinescripts.html
+++ b/doc-src/scripting/inlinescripts.html
@@ -29,46 +29,45 @@ The new header will be added to all responses passing through the proxy.
Called once on startup, before any other events.
-### clientconnect(ScriptContext, ClientConnect)
+### clientconnect(ScriptContext, ConnectionHandler)
Called when a client initiates a connection to the proxy. Note that
a connection can correspond to multiple HTTP requests.
-
-### serverconnect(ScriptContext, ServerConnection)
+### serverconnect(ScriptContext, ConnectionHandler)
Called when the proxy initiates a connection to the target server. Note that
a connection can correspond to multiple HTTP requests.
-### request(ScriptContext, Flow)
+### request(ScriptContext, HTTPFlow)
-Called when a client request has been received. The __Flow__ object is
+Called when a client request has been received. The __HTTPFlow__ object is
guaranteed to have a non-None __request__ attribute.
-### responseheaders(ScriptContext, Flow)
+### responseheaders(ScriptContext, HTTPFlow)
Called when the headers of a server response have been received.
This will always be called before the response hook.
-The __Flow__ object is guaranteed to have non-None __request__ and
-__response__ attributes. __response.content__ will not be valid,
+The __HTTPFlow__ object is guaranteed to have non-None __request__ and
+__response__ attributes. __response.content__ will be None,
as the response body has not been read yet.
-### response(ScriptContext, Flow)
+### response(ScriptContext, HTTPFlow)
-Called when a server response has been received. The __Flow__ object is
+Called when a server response has been received. The __HTTPFlow__ object is
guaranteed to have non-None __request__ and __response__ attributes.
Note that if response streaming is enabled for this response,
__response.content__ will not contain the response body.
-### error(ScriptContext, Flow)
+### error(ScriptContext, HTTPFlow)
Called when a flow error has occurred, e.g. invalid server responses, or
interrupted connections. This is distinct from a valid server HTTP error
-response, which is simply a response with an HTTP error code. The __Flow__
+response, which is simply a response with an HTTP error code. The __HTTPFlow__
object is guaranteed to have non-None __request__ and __error__ attributes.
-### clientdisconnect(ScriptContext, ClientDisconnect)
+### clientdisconnect(ScriptContext, ConnectionHandler)
Called when a client disconnects from the proxy.
@@ -97,22 +96,10 @@ The main classes you will deal with in writing mitmproxy scripts are:
<td>Describes a server connection.</td>
</tr>
<tr>
- <th>libmproxy.protocol.primitives.Error</th>
- <td>A communications error.</td>
- </tr>
- <tr>
<th>libmproxy.protocol.http.HTTPFlow</th>
<td>A collection of objects representing a single HTTP transaction.</td>
</tr>
<tr>
- <th>libmproxy.flow.ODict</th>
-
- <td>A dictionary-like object for managing sets of key/value data. There
- is also a variant called CaselessODict that ignores key case for some
- calls (used mainly for headers).
- </td>
- </tr>
- <tr>
<th>libmproxy.protocol.http.HTTPResponse</th>
<td>An HTTP response.</td>
</tr>
@@ -121,10 +108,22 @@ The main classes you will deal with in writing mitmproxy scripts are:
<td>An HTTP request.</td>
</tr>
<tr>
+ <th>libmproxy.protocol.primitives.Error</th>
+ <td>A communications error.</td>
+ </tr>
+ <tr>
<th>libmproxy.script.ScriptContext</th>
<td> A handle for interacting with mitmproxy's from within scripts.</td>
</tr>
<tr>
+ <th>libmproxy.flow.ODict</th>
+
+ <td>A dictionary-like object for managing sets of key/value data. There
+ is also a variant called CaselessODict that ignores key case for some
+ calls (used mainly for headers).
+ </td>
+ </tr>
+ <tr>
<th>libmproxy.certutils.SSLCert</th>
<td>Exposes information SSL certificates.</td>
</tr>
@@ -161,9 +160,9 @@ flows from a file (see the "scripted data transformation" example on the
one-shot script on a single flow through the _|_ (pipe) shortcut in mitmproxy.
In this case, there are no client connections, and the events are run in the
-following order: __start__, __request__, __response__, __error__, __done__. If
+following order: __start__, __request__, __responseheaders__, __response__, __error__, __done__. If
the flow doesn't have a __response__ or __error__ associated with it, the
-matching event will be skipped.
+matching events will be skipped.
## Spaces in the script path
By default, spaces are interpreted as separator between the inline script and its arguments (e.g. <code>-s "foo.py