mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 10:16:27 +00:00
Remove promotion to raw TCP based on heuristics
This seems terribly dangerous to me. Let's expand explicit control instead.
This commit is contained in:
parent
3958940420
commit
fbaade4298
@ -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"
|
||||
|
@ -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=()):
|
||||
|
Loading…
Reference in New Issue
Block a user