aboutsummaryrefslogtreecommitdiffstats
path: root/netlib
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-06-25 16:16:01 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-06-25 16:16:01 +1200
commitea457fac2e270c258172be65a0eeb4701ad23d8e (patch)
treec52b125123348bd3203e6b02df06617be26383ac /netlib
parent353efec7ce032a447efbba60c5ccea441bc573fb (diff)
downloadmitmproxy-ea457fac2e270c258172be65a0eeb4701ad23d8e.tar.gz
mitmproxy-ea457fac2e270c258172be65a0eeb4701ad23d8e.tar.bz2
mitmproxy-ea457fac2e270c258172be65a0eeb4701ad23d8e.zip
Perform handshake immediately on SSL conversion.
Otherwise the handshake happens at first write, which can balls up if either side hangs immediately.
Diffstat (limited to 'netlib')
-rw-r--r--netlib/tcp.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/netlib/tcp.py b/netlib/tcp.py
index 3c5c89b7..276d3162 100644
--- a/netlib/tcp.py
+++ b/netlib/tcp.py
@@ -59,6 +59,7 @@ class TCPClient:
context.use_certificate_file(self.clientcert)
self.connection = SSL.Connection(context, self.connection)
self.connection.set_connect_state()
+ self.connection.do_handshake()
self.cert = self.connection.get_peer_certificate()
self.rfile = FileLike(self.connection)
self.wfile = FileLike(self.connection)
@@ -95,6 +96,7 @@ class BaseHandler:
ctx.use_certificate_file(cert)
self.connection = SSL.Connection(ctx, self.connection)
self.connection.set_accept_state()
+ self.connection.do_handshake()
self.rfile = FileLike(self.connection)
self.wfile = FileLike(self.connection)