aboutsummaryrefslogtreecommitdiffstats
path: root/docs/scripting
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2016-11-12 18:28:37 +1300
committerAldo Cortesi <aldo@nullcube.com>2016-11-12 18:28:37 +1300
commita9b4560187df02c0d69e89a4892587a65bb03ea7 (patch)
treeb58824c3fdf7aa90539c391b5478845ce6b8c99a /docs/scripting
parent38f8d9e541f8d60cf3d829f6ac2c204ef493680f (diff)
downloadmitmproxy-a9b4560187df02c0d69e89a4892587a65bb03ea7.tar.gz
mitmproxy-a9b4560187df02c0d69e89a4892587a65bb03ea7.tar.bz2
mitmproxy-a9b4560187df02c0d69e89a4892587a65bb03ea7.zip
Refine handling of HTTP CONNECT
- CONNECT requests do not generate the usual http events. Instead, they generate the http_connect event and handlers then have the option of setting an error response to abort the connect. - The connect handler is called for both upstream proxy and regular proxy CONNECTs.
Diffstat (limited to 'docs/scripting')
-rw-r--r--docs/scripting/events.rst13
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/scripting/events.rst b/docs/scripting/events.rst
index 62266485..a5721403 100644
--- a/docs/scripting/events.rst
+++ b/docs/scripting/events.rst
@@ -98,6 +98,19 @@ HTTP Events
:widths: 40 60
:header-rows: 0
+ * - .. py:function:: http_connect(flow)
+
+ - Called when we receive an HTTP CONNECT request. Setting a non 2xx
+ response on the flow will return the response to the client abort the
+ connection. CONNECT requests and responses do not generate the usual
+ HTTP handler events. CONNECT requests are only valid in regular and
+ upstream proxy modes.
+
+ *flow*
+ A ``models.HTTPFlow`` object. The flow is guaranteed to have
+ non-None ``request`` and ``requestheaders`` attributes.
+
+
* - .. py:function:: request(flow)
- Called when a client request has been received.