diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py index 11735ec04..fcfc53b82 100644 --- a/libmproxy/protocol/http.py +++ b/libmproxy/protocol/http.py @@ -988,7 +988,7 @@ class HTTPHandler(ProtocolHandler): self.c.channel.ask("error" if LEGACY else "httperror", flow.error if LEGACY else flow) else: - pass # FIXME: Is there any use case for persisting errors that occur outside of flows? + pass # FIXME: Is there any use case for persisting errors that occur outside of flows? if code: try: diff --git a/libmproxy/protocol/tcp.py b/libmproxy/protocol/tcp.py index 9fb2e01b1..4441d2f00 100644 --- a/libmproxy/protocol/tcp.py +++ b/libmproxy/protocol/tcp.py @@ -15,10 +15,12 @@ class TCPHandler(ProtocolHandler): for rfile in r: if self.c.client_conn.rfile == rfile: src, dst = self.c.client_conn, self.c.server_conn - src_str, dst_str = "client", "server" + direction = "-> tcp ->" + dst_str = "%s:%s" % self.c.server_conn.address()[:2] else: dst, src = self.c.client_conn, self.c.server_conn - dst_str, src_str = "client", "server" + direction = "<- tcp <-" + dst_str = "client" data = StringIO() while range(4096): @@ -52,6 +54,6 @@ class TCPHandler(ProtocolHandler): self.c.close = True break - self.c.log("%s -> %s" % (src_str, dst_str), ["\r\n" + data]) + self.c.log("%s %s" % (direction, dst_str), ["\r\n" + data]) dst.wfile.write(data) dst.wfile.flush() \ No newline at end of file diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index 82d7ecefa..e63573fbe 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -234,6 +234,7 @@ class ConnectionHandler: try: protocol.handle_messages(self.conntype, self) except protocol.ConnectionTypeChange: + self.log("Connection Type Changed: %s" % self.conntype) continue # FIXME: Do we want to persist errors? @@ -279,7 +280,7 @@ class ConnectionHandler: self.server_conn.connect() except tcp.NetLibError, v: raise ProxyError(502, v) - self.log("serverconnect", ["%s:%s" % address]) + self.log("serverconnect", ["%s:%s" % address[:2]]) self.channel.tell("serverconnect", self) def establish_ssl(self, client=False, server=False): @@ -307,7 +308,7 @@ class ConnectionHandler: def server_reconnect(self, no_ssl=False): had_ssl, sni = self.server_conn.ssl_established, self.sni self.log("server reconnect (ssl: %s, sni: %s)" % (had_ssl, sni)) - self.establish_server_connection(self.server_conn.address) + self.establish_server_connection(self.server_conn.address()) if had_ssl and not no_ssl: self.sni = sni self.establish_ssl(server=True)