From 4b4a18a2e4d7cf3e8862192b68f5a2295da9acbe Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Mon, 21 Jul 2014 21:06:55 +0200 Subject: add --stream options, various fixes --- examples/stream.py | 5 +++++ examples/stub.py | 9 +++++++++ 2 files changed, 14 insertions(+) create mode 100644 examples/stream.py (limited to 'examples') 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. -- cgit v1.2.3