aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/proxy
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2015-08-18 14:15:08 +0200
committerMaximilian Hils <git@maximilianhils.com>2015-08-18 14:15:08 +0200
commit96de7ad562da9b5110059988b851c66b51874510 (patch)
treea8696a74835638376453c576ecf502cbf74373c0 /libmproxy/proxy
parent99129ab5a15bc4708eda80e4f56b46bb0f1efa86 (diff)
downloadmitmproxy-96de7ad562da9b5110059988b851c66b51874510.tar.gz
mitmproxy-96de7ad562da9b5110059988b851c66b51874510.tar.bz2
mitmproxy-96de7ad562da9b5110059988b851c66b51874510.zip
various fixes
Diffstat (limited to 'libmproxy/proxy')
-rw-r--r--libmproxy/proxy/connection.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/libmproxy/proxy/connection.py b/libmproxy/proxy/connection.py
index f92b53aa..c9b57998 100644
--- a/libmproxy/proxy/connection.py
+++ b/libmproxy/proxy/connection.py
@@ -27,6 +27,9 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
self.timestamp_ssl_setup = None
self.protocol = None
+ def __nonzero__(self):
+ return bool(self.connection) and not self.finished
+
def __repr__(self):
return "<ClientConnection: {ssl}{host}:{port}>".format(
ssl="[ssl] " if self.ssl_established else "",
@@ -89,7 +92,7 @@ class ServerConnection(tcp.TCPClient, stateobject.StateObject):
def __init__(self, address):
tcp.TCPClient.__init__(self, address)
- self.state = [] # a list containing (conntype, state) tuples
+ self.via = None
self.timestamp_start = None
self.timestamp_end = None
self.timestamp_tcp_setup = None
@@ -97,7 +100,7 @@ class ServerConnection(tcp.TCPClient, stateobject.StateObject):
self.protocol = None
def __nonzero__(self):
- return bool(self.connection)
+ return bool(self.connection) and not self.finished
def __repr__(self):
if self.ssl_established and self.sni:
@@ -117,7 +120,6 @@ class ServerConnection(tcp.TCPClient, stateobject.StateObject):
return self.ssl_established
_stateobject_attributes = dict(
- state=list,
timestamp_start=float,
timestamp_end=float,
timestamp_tcp_setup=float,
@@ -187,3 +189,5 @@ class ServerConnection(tcp.TCPClient, stateobject.StateObject):
def finish(self):
tcp.TCPClient.finish(self)
self.timestamp_end = utils.timestamp()
+
+ServerConnection._stateobject_attributes["via"] = ServerConnection \ No newline at end of file