aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/proxy.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2013-07-28 10:50:25 +1200
committerAldo Cortesi <aldo@nullcube.com>2013-07-28 10:50:25 +1200
commit10b744ee0810b56143d5dbca79eaaca94ab0e21e (patch)
treebd58605635f98a1f0eb604a5479b469d11ba9cb3 /libmproxy/proxy.py
parent5c1157ddaf01b9245519d176469587aa6539ac5d (diff)
downloadmitmproxy-10b744ee0810b56143d5dbca79eaaca94ab0e21e.tar.gz
mitmproxy-10b744ee0810b56143d5dbca79eaaca94ab0e21e.tar.bz2
mitmproxy-10b744ee0810b56143d5dbca79eaaca94ab0e21e.zip
Properly terminate SSL server connections.
Before, we had dangling SSL server connections causing resource exhaustion. I believe this fixe #144 and #153
Diffstat (limited to 'libmproxy/proxy.py')
-rw-r--r--libmproxy/proxy.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py
index a7d8d2ba..79025a34 100644
--- a/libmproxy/proxy.py
+++ b/libmproxy/proxy.py
@@ -58,7 +58,6 @@ class ServerConnection(tcp.TCPClient):
self.tcp_setup_timestamp = None
self.ssl_setup_timestamp = None
-
def connect(self):
tcp.TCPClient.connect(self)
self.tcp_setup_timestamp = time.time()
@@ -179,6 +178,8 @@ class ProxyHandler(tcp.BaseHandler):
return self.server_conn
def del_server_connection(self):
+ if self.server_conn:
+ self.server_conn.terminate()
self.server_conn = None
def handle(self):
@@ -188,6 +189,7 @@ class ProxyHandler(tcp.BaseHandler):
while self.handle_request(cc) and not cc.close:
pass
cc.close = True
+ self.del_server_connection()
cd = flow.ClientDisconnect(cc)
self.log(