aboutsummaryrefslogtreecommitdiffstats
path: root/doc-src/features
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2014-07-25 19:31:12 +0200
committerMaximilian Hils <git@maximilianhils.com>2014-07-25 19:31:12 +0200
commit7b2cfc831ddeb543a8329bd08f1254742897de13 (patch)
treedf765f0125482a4d1c69537bf98e982dc608bb9b /doc-src/features
parent5a808ca2a7db9649eac69f8e4eb50e5ef24197fa (diff)
downloadmitmproxy-7b2cfc831ddeb543a8329bd08f1254742897de13.tar.gz
mitmproxy-7b2cfc831ddeb543a8329bd08f1254742897de13.tar.bz2
mitmproxy-7b2cfc831ddeb543a8329bd08f1254742897de13.zip
docs++
Diffstat (limited to 'doc-src/features')
-rw-r--r--doc-src/features/responsestreaming.html68
1 files changed, 33 insertions, 35 deletions
diff --git a/doc-src/features/responsestreaming.html b/doc-src/features/responsestreaming.html
index 176fa4ae..d20af65c 100644
--- a/doc-src/features/responsestreaming.html
+++ b/doc-src/features/responsestreaming.html
@@ -1,52 +1,50 @@
+By using mitmproxy's streaming feature, response contents can be passed to the client incrementally before they have been fully received by the proxy.
+This is especially useful for large binary files such as videos, where buffering the whole file slows down the client's browser.
By default, mitmproxy will read the entire response, perform any indicated
-manipulations on it and then send the (possibly modified) response back to
-the client. In some cases this is undesirable and you may wish to "stream"
-the reponse back to the client. When streaming is enabled, the response is
-not buffered but is instead sent directly back to the client. (If HTTP
-chunked transfer encoding is enabled, the response will be streamed
-back one chunk at a time.) This is especially useful for large binary files,
-which are often not what you are trying to inspect, and while buffering
-cause browser slows.
-
-Streaming can be enabled on the command line for all responses which are
-greater than a certain size. Note that the SIZE argument below can accept
-the usual prefixes (m, k, etc.)
+manipulations on it and then send the (possibly modified) response to
+the client. In some cases this is undesirable and you may wish to "stream"
+the reponse back to the client. When streaming is enabled, the response is
+not buffered on the proxy but directly sent back to the client instead.
+
+<h2>On the command-line</h2>
+
+Streaming can be enabled on the command line for all response bodies exceeding a certain size. The SIZE argument understands
+k/m/g suffixes, e.g. 3m for 3 megabytes.
<table class="table">
<tbody>
- <tr>
- <th width="20%">command-line</th>
- <td>
- <ul>
- <li>--stream SIZE</li>
- </ul>
- </td>
- </tr>
+ <tr>
+ <th width="20%">command-line</th>
+ <td>
+ --stream SIZE
+ </td>
+ </tr>
</tbody>
</table>
-<div class="page-header">
- <h1>Customizing Response Streaming</h1>
-</div>
-You can also use an inline script hook to write code to customize exactly
+<h2>Caveats</h2>
+
+When response streaming is enabled, <strong>streamed response contents will not be
+ recorded or preserved in any way.</strong>
+
+When response streaming is enabled, the response body cannot be modified.
+
+<h2>Customizing Response Streaming</h2>
+
+You can also use an <a href="@!urlTo("scripting/inlinescripts.html")!@">inline script</a> to customize exactly
which responses are streamed.
-The basic concept is simple:
+Responses that should be tagged for streaming by setting their respective .stream attribute to True:
$!example("examples/stream.py")!$
-See [inline scripts](@!urlTo("scripting/inlinescripts.html")!@) for more
-info on how to make and use inline scripts in general.
-<div class="page-header">
- <h1>Things to Know</h1>
-</div>
+<h2>Implementation Details</h2>
-When response streaming is enabled, streamed response content will not be
-recorded with the -w parameter.
+When response streaming is enabled, portions of the code which would have otherwise performed changes
+on the response body will see an empty response body instead (<code>libmproxy.protocol.http.CONTENT_MISSING</code>). Any modifications will be ignored.
-Portions of the code which would have otherwise performed changes
-on the response body will instead see an empty response body
-and any attempts to modify it will be ignored.
+Streamed responses are usually sent in chunks of 4096 bytes. If the response is sent with a <code>Transfer-Encoding:
+ chunked</code> header, the response will be streamed one chunk at a time. \ No newline at end of file