diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-08-14 10:41:11 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-08-14 10:41:11 +0200 |
commit | 808218f4bc64be8de065604f6509eb75d98fde88 (patch) | |
tree | ae9320c3153761acb9924a5eb52b8a6162c43448 /libmproxy/protocol2/tls.py | |
parent | aef3b626a70de5f385c8f5496c2e49575b5c3e1c (diff) | |
download | mitmproxy-808218f4bc64be8de065604f6509eb75d98fde88.tar.gz mitmproxy-808218f4bc64be8de065604f6509eb75d98fde88.tar.bz2 mitmproxy-808218f4bc64be8de065604f6509eb75d98fde88.zip |
more work on http layer
Diffstat (limited to 'libmproxy/protocol2/tls.py')
-rw-r--r-- | libmproxy/protocol2/tls.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libmproxy/protocol2/tls.py b/libmproxy/protocol2/tls.py index 999cbea6..988304aa 100644 --- a/libmproxy/protocol2/tls.py +++ b/libmproxy/protocol2/tls.py @@ -1,4 +1,5 @@ from __future__ import (absolute_import, print_function, division) + import traceback from netlib import tcp @@ -99,7 +100,7 @@ class TlsLayer(Layer): if server_err and not self.client_sni: raise server_err - def handle_sni(self, connection): + def __handle_sni(self, connection): """ This callback gets called during the TLS handshake with the client. The client has just sent the Sever Name Indication (SNI). @@ -119,7 +120,7 @@ class TlsLayer(Layer): if self.client_sni: # Now, change client context to reflect possibly changed certificate: - cert, key, chain_file = self.find_cert() + cert, key, chain_file = self._find_cert() new_context = self.client_conn.create_ssl_context( cert, key, method=self.config.openssl_method_client, @@ -137,13 +138,13 @@ class TlsLayer(Layer): @yield_from_callback def _establish_tls_with_client(self): self.log("Establish TLS with client", "debug") - cert, key, chain_file = self.find_cert() + cert, key, chain_file = self._find_cert() try: self.client_conn.convert_to_ssl( cert, key, method=self.config.openssl_method_client, options=self.config.openssl_options_client, - handle_sni=self.handle_sni, + handle_sni=self.__handle_sni, cipher_list=self.config.ciphers_client, dhparams=self.config.certstore.dhparams, chain_file=chain_file @@ -182,7 +183,7 @@ class TlsLayer(Layer): except tcp.NetLibError as e: raise ProtocolException(repr(e), e) - def find_cert(self): + def _find_cert(self): host = self.server_conn.address.host sans = set() # Incorporate upstream certificate |