mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-02-01 07:49:10 +00:00
Revert "Remove promotion to raw TCP based on heuristics"
This reverts commit fbaade4298
for the following reasons:
- The commit only removed the proxy logic, while keeping the corresponding command line
options etc. intact. That is quite confusing.
- The switch is (and has been) off-by-default and the option help now clearly states
that this needs to be used with caution. I'd argue that constrains the potential danger.
- I have a specific use case that needs this, and implementing it as an addon is rather
difficult at the moment.
That being said, this revert is a rather pragmatic temporary decision,
the functionality should clearly be made more explicit and protocol switching should
be moved to an addon.
This commit is contained in:
parent
1f98c7be4f
commit
9ca6785d40
@ -104,7 +104,16 @@ class RootContext:
|
||||
if alpn == b'http/1.1':
|
||||
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)
|
||||
|
||||
def log(self, msg, level, subs=()):
|
||||
|
Loading…
Reference in New Issue
Block a user