From 17a32d921cd2df98ad2f7861eb9165ec20dc7314 Mon Sep 17 00:00:00 2001 From: David Weinstein Date: Tue, 26 Jan 2016 11:38:14 -0500 Subject: [PATCH] Log exceptions parsing TlsClientHello in TlsLayer --- libmproxy/protocol/tls.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libmproxy/protocol/tls.py b/libmproxy/protocol/tls.py index f05648ac2..0b47af782 100644 --- a/libmproxy/protocol/tls.py +++ b/libmproxy/protocol/tls.py @@ -360,10 +360,13 @@ class TlsLayer(Layer): """ Peek into the connection, read the initial client hello and parse it to obtain ALPN values. """ - parsed = TlsClientHello.from_client_conn(self.client_conn) - self.client_sni = parsed.client_sni - self.client_alpn_protocols = parsed.client_alpn_protocols - self.client_ciphers = parsed.client_cipher_suites + try: + parsed = TlsClientHello.from_client_conn(self.client_conn) + self.client_sni = parsed.client_sni + self.client_alpn_protocols = parsed.client_alpn_protocols + self.client_ciphers = parsed.client_cipher_suites + except TlsProtocolException as e: + self.log("Cannot parse Client Hello: %s" % repr(e), "error") def connect(self): if not self.server_conn: