mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
Minor aesthetic fixes.
This commit is contained in:
parent
192f033967
commit
918a457f5a
@ -89,8 +89,6 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
|
|||||||
|
|
||||||
class ServerConnection(tcp.TCPClient, stateobject.StateObject):
|
class ServerConnection(tcp.TCPClient, stateobject.StateObject):
|
||||||
def __init__(self, address, source_address=None):
|
def __init__(self, address, source_address=None):
|
||||||
if source_address:
|
|
||||||
source_address = (source_address, 0)
|
|
||||||
tcp.TCPClient.__init__(self, address, source_address)
|
tcp.TCPClient.__init__(self, address, source_address)
|
||||||
|
|
||||||
self.via = None
|
self.via = None
|
||||||
|
@ -109,9 +109,9 @@ class ServerConnectionMixin(object):
|
|||||||
self.disconnect()
|
self.disconnect()
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, server_address=None, source_address=None):
|
def __init__(self, server_address=None):
|
||||||
super(ServerConnectionMixin, self).__init__()
|
super(ServerConnectionMixin, self).__init__()
|
||||||
self.server_conn = ServerConnection(server_address, source_address)
|
self.server_conn = ServerConnection(server_address)
|
||||||
self.__check_self_connect()
|
self.__check_self_connect()
|
||||||
|
|
||||||
def __check_self_connect(self):
|
def __check_self_connect(self):
|
||||||
@ -157,7 +157,7 @@ class ServerConnectionMixin(object):
|
|||||||
"""
|
"""
|
||||||
self.log("serverdisconnect", "debug", [repr(self.server_conn.address)])
|
self.log("serverdisconnect", "debug", [repr(self.server_conn.address)])
|
||||||
address = self.server_conn.address
|
address = self.server_conn.address
|
||||||
source_address = self.server_conn.source_address()[0]
|
source_address = self.server_conn.source_address
|
||||||
self.server_conn.finish()
|
self.server_conn.finish()
|
||||||
self.server_conn.close()
|
self.server_conn.close()
|
||||||
self.channel.tell("serverdisconnect", self.server_conn)
|
self.channel.tell("serverdisconnect", self.server_conn)
|
||||||
|
@ -46,7 +46,7 @@ class RequestReplayThread(threading.Thread):
|
|||||||
# In all modes, we directly connect to the server displayed
|
# In all modes, we directly connect to the server displayed
|
||||||
if self.config.mode == "upstream":
|
if self.config.mode == "upstream":
|
||||||
server_address = self.config.upstream_server.address
|
server_address = self.config.upstream_server.address
|
||||||
server = ServerConnection(server_address, self.config.host)
|
server = ServerConnection(server_address, (self.config.host, 0))
|
||||||
server.connect()
|
server.connect()
|
||||||
if r.scheme == "https":
|
if r.scheme == "https":
|
||||||
connect_request = make_connect_request((r.host, r.port))
|
connect_request = make_connect_request((r.host, r.port))
|
||||||
@ -68,7 +68,7 @@ class RequestReplayThread(threading.Thread):
|
|||||||
r.form_out = "absolute"
|
r.form_out = "absolute"
|
||||||
else:
|
else:
|
||||||
server_address = (r.host, r.port)
|
server_address = (r.host, r.port)
|
||||||
server = ServerConnection(server_address, self.config.host)
|
server = ServerConnection(server_address, (self.config.host, 0))
|
||||||
server.connect()
|
server.connect()
|
||||||
if r.scheme == "https":
|
if r.scheme == "https":
|
||||||
server.establish_ssl(
|
server.establish_ssl(
|
||||||
|
Loading…
Reference in New Issue
Block a user