mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 10:16:27 +00:00
This commit is contained in:
parent
218e69ddb2
commit
5ebc338fde
@ -6,6 +6,7 @@ Unreleased: mitmproxy next
|
|||||||
* Use `@charset` to decode CSS files if available (@prinzhorn)
|
* Use `@charset` to decode CSS files if available (@prinzhorn)
|
||||||
* Fix links to anticache docs in mitmweb and use HTTPS for links to documentation (@rugk)
|
* Fix links to anticache docs in mitmweb and use HTTPS for links to documentation (@rugk)
|
||||||
* Updated typing for WebsocketMessage.content (@prinzhorn)
|
* Updated typing for WebsocketMessage.content (@prinzhorn)
|
||||||
|
* Prevent transparent mode from connecting to itself in the basic cases (@prinzhorn)
|
||||||
|
|
||||||
* --- TODO: add new PRs above this line ---
|
* --- TODO: add new PRs above this line ---
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ class TransparentProxy(protocol.Layer, protocol.ServerConnectionMixin):
|
|||||||
|
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
try:
|
try:
|
||||||
self.server_conn.address = platform.original_addr(self.client_conn.connection)
|
self.set_server(platform.original_addr(self.client_conn.connection))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise exceptions.ProtocolException("Transparent mode failure: %s" % repr(e))
|
raise exceptions.ProtocolException("Transparent mode failure: %s" % repr(e))
|
||||||
|
|
||||||
|
@ -107,9 +107,14 @@ class ServerConnectionMixin:
|
|||||||
"""
|
"""
|
||||||
address = self.server_conn.address
|
address = self.server_conn.address
|
||||||
if address:
|
if address:
|
||||||
|
forbidden_hosts = ["localhost", "127.0.0.1", "::1"]
|
||||||
|
|
||||||
|
if self.config.options.listen_host:
|
||||||
|
forbidden_hosts.append(self.config.options.listen_host)
|
||||||
|
|
||||||
self_connect = (
|
self_connect = (
|
||||||
address[1] == self.config.options.listen_port and
|
address[1] == self.config.options.listen_port and
|
||||||
address[0] in ("localhost", "127.0.0.1", "::1")
|
address[0] in forbidden_hosts
|
||||||
)
|
)
|
||||||
if self_connect:
|
if self_connect:
|
||||||
raise exceptions.ProtocolException(
|
raise exceptions.ProtocolException(
|
||||||
|
Loading…
Reference in New Issue
Block a user