aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/addons/streambodies.py
diff options
context:
space:
mode:
Diffstat (limited to 'mitmproxy/addons/streambodies.py')
-rw-r--r--mitmproxy/addons/streambodies.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/mitmproxy/addons/streambodies.py b/mitmproxy/addons/streambodies.py
index c841075f..6ca9918f 100644
--- a/mitmproxy/addons/streambodies.py
+++ b/mitmproxy/addons/streambodies.py
@@ -1,3 +1,5 @@
+import typing
+
from mitmproxy.net.http import http1
from mitmproxy import exceptions
from mitmproxy import ctx
@@ -8,6 +10,23 @@ class StreamBodies:
def __init__(self):
self.max_size = None
+ def load(self, loader):
+ loader.add_option(
+ "stream_large_bodies", typing.Optional[str], None,
+ """
+ Stream data to the client if response body exceeds the given
+ threshold. If streamed, the body will not be stored in any way.
+ Understands k/m/g suffixes, i.e. 3m for 3 megabytes.
+ """
+ )
+ loader.add_option(
+ "stream_websockets", bool, False,
+ """
+ Stream WebSocket messages between client and server.
+ Messages are captured and cannot be modified.
+ """
+ )
+
def configure(self, updated):
if "stream_large_bodies" in updated and ctx.options.stream_large_bodies:
try: