diff options
author | Thomas Kriechbaumer <Kriechi@users.noreply.github.com> | 2020-04-04 15:54:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-04 15:54:00 +0200 |
commit | ac83db3b840ecdbbc8ba232ae151b75d15e4a679 (patch) | |
tree | 697a56dd92027027a3b30657ccaabee6dbd011c5 /examples/addons/events-http-specific.py | |
parent | 9cc5d933c19b968df4d58fde6f69e829d3e064b9 (diff) | |
parent | 678be7a052007e26939b5f0cfa13200ab032cf86 (diff) | |
download | mitmproxy-ac83db3b840ecdbbc8ba232ae151b75d15e4a679.tar.gz mitmproxy-ac83db3b840ecdbbc8ba232ae151b75d15e4a679.tar.bz2 mitmproxy-ac83db3b840ecdbbc8ba232ae151b75d15e4a679.zip |
Merge pull request #3898 from Kriechi/websocket-docs
improve scripting docs
Diffstat (limited to 'examples/addons/events-http-specific.py')
-rw-r--r-- | examples/addons/events-http-specific.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/examples/addons/events-http-specific.py b/examples/addons/events-http-specific.py new file mode 100644 index 00000000..37d9f91a --- /dev/null +++ b/examples/addons/events-http-specific.py @@ -0,0 +1,42 @@ +import mitmproxy.http + + +class Events: + # HTTP lifecycle + def http_connect(self, flow: mitmproxy.http.HTTPFlow): + """ + An HTTP CONNECT request was received. 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. + """ + + def requestheaders(self, flow: mitmproxy.http.HTTPFlow): + """ + HTTP request headers were successfully read. At this point, the body + is empty. + """ + + def request(self, flow: mitmproxy.http.HTTPFlow): + """ + The full HTTP request has been read. + """ + + def responseheaders(self, flow: mitmproxy.http.HTTPFlow): + """ + HTTP response headers were successfully read. At this point, the body + is empty. + """ + + def response(self, flow: mitmproxy.http.HTTPFlow): + """ + The full HTTP response has been read. + """ + + def error(self, flow: mitmproxy.http.HTTPFlow): + """ + An HTTP 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. + """ |