mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-02-01 15:55:28 +00:00
commit
e0ca9c3a98
@ -173,7 +173,7 @@ class Options(optmanager.OptManager):
|
|||||||
)
|
)
|
||||||
self.add_option(
|
self.add_option(
|
||||||
"server", bool, True,
|
"server", bool, True,
|
||||||
"Start a proxy server."
|
"Start a proxy server. Enabled by default."
|
||||||
)
|
)
|
||||||
self.add_option(
|
self.add_option(
|
||||||
"server_replay_nopop", bool, False,
|
"server_replay_nopop", bool, False,
|
||||||
@ -406,8 +406,9 @@ class Options(optmanager.OptManager):
|
|||||||
)
|
)
|
||||||
self.add_option(
|
self.add_option(
|
||||||
"rawtcp", bool, False,
|
"rawtcp", bool, False,
|
||||||
"Enable/disable experimental raw TCP support. "
|
"Enable/disable experimental raw TCP support. TCP connections starting with non-ascii "
|
||||||
"Disabled by default. "
|
"bytes are treated as if they would match tcp_hosts. The heuristic is very rough, use "
|
||||||
|
"with caution. Disabled by default. "
|
||||||
)
|
)
|
||||||
|
|
||||||
self.add_option(
|
self.add_option(
|
||||||
|
@ -104,7 +104,16 @@ class RootContext:
|
|||||||
if alpn == b'http/1.1':
|
if alpn == b'http/1.1':
|
||||||
return protocol.Http1Layer(top_layer, http.HTTPMode.transparent)
|
return protocol.Http1Layer(top_layer, http.HTTPMode.transparent)
|
||||||
|
|
||||||
# 6. Assume HTTP1 by default
|
# 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
|
||||||
return protocol.Http1Layer(top_layer, http.HTTPMode.transparent)
|
return protocol.Http1Layer(top_layer, http.HTTPMode.transparent)
|
||||||
|
|
||||||
def log(self, msg, level, subs=()):
|
def log(self, msg, level, subs=()):
|
||||||
|
Loading…
Reference in New Issue
Block a user