From 77aeac11a9353f290a9e4dfc1af1df4f597f48ee Mon Sep 17 00:00:00 2001 From: Colin Bendell Date: Wed, 7 Oct 2015 20:30:31 -0400 Subject: [PATCH] Check if server connection hasn't yet been initiated This fixes #761 when NoneType error is thrown when non-TLS requests initiate a client request but the server connection hasn't yet been initiated. --- libmproxy/models/connections.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmproxy/models/connections.py b/libmproxy/models/connections.py index f1e10de9f..ab0462474 100644 --- a/libmproxy/models/connections.py +++ b/libmproxy/models/connections.py @@ -135,8 +135,8 @@ class ServerConnection(tcp.TCPClient, stateobject.StateObject): def get_state(self, short=False): d = super(ServerConnection, self).get_state(short) d.update( - address={"address": self.address(), - "use_ipv6": self.address.use_ipv6}, + address=({"address": self.address(), + "use_ipv6": self.address.use_ipv6} if self.address else None), source_address=({"address": self.source_address(), "use_ipv6": self.source_address.use_ipv6} if self.source_address else None), cert=self.cert.to_pem() if self.cert else None