diff options
Diffstat (limited to 'mitmproxy/proxy/protocol')
-rw-r--r-- | mitmproxy/proxy/protocol/http1.py | 5 | ||||
-rw-r--r-- | mitmproxy/proxy/protocol/http2.py | 3 | ||||
-rw-r--r-- | mitmproxy/proxy/protocol/http_replay.py | 3 |
3 files changed, 7 insertions, 4 deletions
diff --git a/mitmproxy/proxy/protocol/http1.py b/mitmproxy/proxy/protocol/http1.py index 84cd6324..91f1e9b7 100644 --- a/mitmproxy/proxy/protocol/http1.py +++ b/mitmproxy/proxy/protocol/http1.py @@ -1,6 +1,7 @@ from mitmproxy import http from mitmproxy.proxy.protocol import http as httpbase from mitmproxy.net.http import http1 +from mitmproxy.utils import human class Http1Layer(httpbase._HttpTransmissionLayer): @@ -19,7 +20,7 @@ class Http1Layer(httpbase._HttpTransmissionLayer): return http1.read_body( self.client_conn.rfile, expected_size, - self.config.options._processed.get("body_size_limit") + human.parse_size(self.config.options.body_size_limit) ) def send_request_headers(self, request): @@ -45,7 +46,7 @@ class Http1Layer(httpbase._HttpTransmissionLayer): return http1.read_body( self.server_conn.rfile, expected_size, - self.config.options._processed.get("body_size_limit") + human.parse_size(self.config.options.body_size_limit) ) def send_response_headers(self, response): diff --git a/mitmproxy/proxy/protocol/http2.py b/mitmproxy/proxy/protocol/http2.py index eab5292f..cf021291 100644 --- a/mitmproxy/proxy/protocol/http2.py +++ b/mitmproxy/proxy/protocol/http2.py @@ -17,6 +17,7 @@ import mitmproxy.net.http from mitmproxy.net import tcp from mitmproxy.types import basethread from mitmproxy.net.http import http2, headers +from mitmproxy.utils import human class SafeH2Connection(connection.H2Connection): @@ -183,7 +184,7 @@ class Http2Layer(base.Layer): return True def _handle_data_received(self, eid, event, source_conn): - bsl = self.config.options._processed.get("body_size_limit") + bsl = human.parse_size(self.config.options.body_size_limit) if bsl and self.streams[eid].queued_data_length > bsl: self.streams[eid].kill() self.connections[source_conn].safe_reset_stream( diff --git a/mitmproxy/proxy/protocol/http_replay.py b/mitmproxy/proxy/protocol/http_replay.py index 915c71c4..fd673a6f 100644 --- a/mitmproxy/proxy/protocol/http_replay.py +++ b/mitmproxy/proxy/protocol/http_replay.py @@ -12,6 +12,7 @@ from mitmproxy import connections from mitmproxy.net import server_spec from mitmproxy.net.http import http1 from mitmproxy.types import basethread +from mitmproxy.utils import human # TODO: Doesn't really belong into mitmproxy.proxy.protocol... @@ -44,7 +45,7 @@ class RequestReplayThread(basethread.BaseThread): def run(self): r = self.f.request - bsl = self.options._processed.get("body_size_limit") + bsl = human.parse_size(self.options.body_size_limit) first_line_format_backup = r.first_line_format server = None try: |