From fbaade429845546d751110caa0f886f7b1a62717 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sat, 5 Nov 2016 16:20:38 +1300 Subject: Remove promotion to raw TCP based on heuristics This seems terribly dangerous to me. Let's expand explicit control instead. --- mitmproxy/proxy/protocol/http.py | 2 +- mitmproxy/proxy/root_context.py | 11 +---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/mitmproxy/proxy/protocol/http.py b/mitmproxy/proxy/protocol/http.py index 9fe83ff6..3bc33ab0 100644 --- a/mitmproxy/proxy/protocol/http.py +++ b/mitmproxy/proxy/protocol/http.py @@ -138,7 +138,7 @@ class HttpLayer(base.Layer): def __init__(self, ctx, mode): super().__init__(ctx) if mode not in MODES: - raise exceptions.ServerException("Invalid mode: %s"%mode) + raise exceptions.ServerException("Invalid mode: %s" % mode) self.mode = mode self.__initial_server_conn = None "Contains the original destination in transparent mode, which needs to be restored" diff --git a/mitmproxy/proxy/root_context.py b/mitmproxy/proxy/root_context.py index eacf7e0b..4362347b 100644 --- a/mitmproxy/proxy/root_context.py +++ b/mitmproxy/proxy/root_context.py @@ -90,16 +90,7 @@ class RootContext: if alpn == b'http/1.1': return protocol.Http1Layer(top_layer, 'transparent') - # 6. Check for raw tcp mode - is_ascii = ( - len(d) == 3 and - # expect A-Za-z - all(65 <= x <= 90 or 97 <= x <= 122 for x in d) - ) - if self.config.options.rawtcp and not is_ascii: - return protocol.RawTCPLayer(top_layer) - - # 7. Assume HTTP1 by default + # 6. Assume HTTP1 by default return protocol.Http1Layer(top_layer, 'transparent') def log(self, msg, level, subs=()): -- cgit v1.2.3