From 5b7e19a77e12ffac2e699d2dc92f96f90114ee01 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Mon, 18 Aug 2014 00:55:30 +0200 Subject: fix #327 --- libmproxy/proxy/connection.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'libmproxy/proxy/connection.py') diff --git a/libmproxy/proxy/connection.py b/libmproxy/proxy/connection.py index a19e3e71..a269dab1 100644 --- a/libmproxy/proxy/connection.py +++ b/libmproxy/proxy/connection.py @@ -22,6 +22,13 @@ class ClientConnection(tcp.BaseHandler, stateobject.SimpleStateObject): self.timestamp_end = None self.timestamp_ssl_setup = None + def __repr__(self): + return "".format( + ssl="[ssl] " if self.ssl_established else "", + host=self.address.host, + port=self.address.port + ) + _stateobject_attributes = dict( timestamp_start=float, timestamp_end=float, @@ -76,6 +83,19 @@ class ServerConnection(tcp.TCPClient, stateobject.SimpleStateObject): self.timestamp_tcp_setup = None self.timestamp_ssl_setup = None + def __repr__(self): + if self.ssl_established and self.sni: + ssl = "[ssl: {0}] ".format(self.sni) + elif self.ssl_established: + ssl = "[ssl] " + else: + ssl = "" + return "".format( + ssl=ssl, + host=self.address.host, + port=self.address.port + ) + _stateobject_attributes = dict( state=list, peername=tuple, -- cgit v1.2.3