diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-06-25 11:23:04 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-06-25 11:23:04 +1200 |
commit | f3237503a77258d37b67c5716ac178cbfd7ffe1b (patch) | |
tree | 3921db85a1abfb52442dcfa21c4bab8dd360bb05 /netlib/tcp.py | |
parent | 8f0754b9c48176aa479dc7701c42b26e115163a5 (diff) | |
download | mitmproxy-f3237503a77258d37b67c5716ac178cbfd7ffe1b.tar.gz mitmproxy-f3237503a77258d37b67c5716ac178cbfd7ffe1b.tar.bz2 mitmproxy-f3237503a77258d37b67c5716ac178cbfd7ffe1b.zip |
Don't connect during __init__ methods for either client or server.
This means we now need to do these things explicitly at the caller.
Diffstat (limited to 'netlib/tcp.py')
-rw-r--r-- | netlib/tcp.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/netlib/tcp.py b/netlib/tcp.py index 007cf3a5..25e83e07 100644 --- a/netlib/tcp.py +++ b/netlib/tcp.py @@ -48,11 +48,10 @@ class FileLike: class TCPClient: - def __init__(self, ssl, host, port, clientcert, sni): - self.ssl, self.host, self.port, self.clientcert, self.sni = ssl, host, port, clientcert, sni + def __init__(self, ssl, host, port, clientcert): + self.ssl, self.host, self.port, self.clientcert = ssl, host, port, clientcert self.connection, self.rfile, self.wfile = None, None, None self.cert = None - self.connect() def connect(self): try: @@ -75,6 +74,9 @@ class TCPClient: class BaseHandler: + """ + The instantiator is expected to call the handle() and finish() methods. + """ rbufsize = -1 wbufsize = 0 def __init__(self, connection, client_address, server): @@ -84,8 +86,6 @@ class BaseHandler: self.client_address = client_address self.server = server - self.handle() - self.finish() def convert_to_ssl(self, cert, key): ctx = SSL.Context(SSL.SSLv23_METHOD) |