aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2014-07-31 22:29:13 +0200
committerMaximilian Hils <git@maximilianhils.com>2014-07-31 22:29:13 +0200
commite9401a2123f416f8dd4c24bb4bbc74f297369133 (patch)
treeafebf68d1091d487ef64083962992ea7b703a80e /examples
parentf5fb1138fdda77ec4a3bb5493479d2f56cdb0851 (diff)
parent3e3dbee936bb71e813d50937118eebff4ba23617 (diff)
downloadmitmproxy-e9401a2123f416f8dd4c24bb4bbc74f297369133.tar.gz
mitmproxy-e9401a2123f416f8dd4c24bb4bbc74f297369133.tar.bz2
mitmproxy-e9401a2123f416f8dd4c24bb4bbc74f297369133.zip
Merge branch 'stream'
Conflicts: libmproxy/protocol/http.py
Diffstat (limited to 'examples')
-rw-r--r--examples/stream.py5
-rw-r--r--examples/stub.py9
2 files changed, 14 insertions, 0 deletions
diff --git a/examples/stream.py b/examples/stream.py
new file mode 100644
index 00000000..f9f03c3e
--- /dev/null
+++ b/examples/stream.py
@@ -0,0 +1,5 @@
+def responseheaders(ctx, flow):
+ """
+ Enables streaming for all responses.
+ """
+ flow.response.stream = True \ No newline at end of file
diff --git a/examples/stub.py b/examples/stub.py
index 78cbfcf2..0cf67db7 100644
--- a/examples/stub.py
+++ b/examples/stub.py
@@ -27,6 +27,15 @@ def request(ctx, flow):
"""
ctx.log("request")
+
+def responseheaders(ctx, flow):
+ """
+ Called when the response headers for a server response have been received,
+ but the response body has not been processed yet. Can be used to tell mitmproxy
+ to stream the response.
+ """
+ ctx.log("responseheaders")
+
def response(ctx, flow):
"""
Called when a server response has been received.