diff --git a/libmproxy/models/connections.py b/libmproxy/models/connections.py index 0cfc17d4e..f5dabe4e9 100644 --- a/libmproxy/models/connections.py +++ b/libmproxy/models/connections.py @@ -89,8 +89,6 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject): class ServerConnection(tcp.TCPClient, stateobject.StateObject): def __init__(self, address, source_address=None): - if source_address: - source_address = (source_address, 0) tcp.TCPClient.__init__(self, address, source_address) self.via = None diff --git a/libmproxy/protocol/base.py b/libmproxy/protocol/base.py index 8a1bea914..cf8771e01 100644 --- a/libmproxy/protocol/base.py +++ b/libmproxy/protocol/base.py @@ -109,9 +109,9 @@ class ServerConnectionMixin(object): self.disconnect() """ - def __init__(self, server_address=None, source_address=None): + def __init__(self, server_address=None): super(ServerConnectionMixin, self).__init__() - self.server_conn = ServerConnection(server_address, source_address) + self.server_conn = ServerConnection(server_address) self.__check_self_connect() def __check_self_connect(self): @@ -157,7 +157,7 @@ class ServerConnectionMixin(object): """ self.log("serverdisconnect", "debug", [repr(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.close() self.channel.tell("serverdisconnect", self.server_conn) diff --git a/libmproxy/protocol/http_replay.py b/libmproxy/protocol/http_replay.py index 409810d5f..63870dfb7 100644 --- a/libmproxy/protocol/http_replay.py +++ b/libmproxy/protocol/http_replay.py @@ -46,7 +46,7 @@ class RequestReplayThread(threading.Thread): # In all modes, we directly connect to the server displayed if self.config.mode == "upstream": server_address = self.config.upstream_server.address - server = ServerConnection(server_address, self.config.host) + server = ServerConnection(server_address, (self.config.host, 0)) server.connect() if r.scheme == "https": connect_request = make_connect_request((r.host, r.port)) @@ -68,7 +68,7 @@ class RequestReplayThread(threading.Thread): r.form_out = "absolute" else: server_address = (r.host, r.port) - server = ServerConnection(server_address, self.config.host) + server = ServerConnection(server_address, (self.config.host, 0)) server.connect() if r.scheme == "https": server.establish_ssl(