diff --git a/libmproxy/contrib/tls/_constructs.py b/libmproxy/contrib/tls/_constructs.py index 9c57a7992c..4cb7d3823a 100644 --- a/libmproxy/contrib/tls/_constructs.py +++ b/libmproxy/contrib/tls/_constructs.py @@ -5,7 +5,7 @@ from __future__ import absolute_import, division, print_function from construct import (Array, Bytes, Struct, UBInt16, UBInt32, UBInt8, PascalString, Embed, TunnelAdapter, GreedyRange, - Switch, OptionalGreedyRange) + Switch, OptionalGreedyRange, Optional) from .utils import UBInt24 @@ -112,7 +112,7 @@ ) extensions = TunnelAdapter( - PascalString("extensions", length_field=UBInt16("extensions_length")), + Optional(PascalString("extensions", length_field=UBInt16("extensions_length"))), OptionalGreedyRange(Extension) ) diff --git a/libmproxy/protocol/tls.py b/libmproxy/protocol/tls.py index 871926eea9..ed74764321 100644 --- a/libmproxy/protocol/tls.py +++ b/libmproxy/protocol/tls.py @@ -318,7 +318,7 @@ def _parse_client_hello(self): client_hello = ClientHello.parse(raw_client_hello) except ConstructError as e: self.log("Cannot parse Client Hello: %s" % repr(e), "error") - self.log("Raw Client Hello:\r\n:%s" % raw_client_hello.encode("hex"), "debug") + self.log("Raw Client Hello: %s" % raw_client_hello.encode("hex"), "debug") return self.client_ciphers = client_hello.cipher_suites.cipher_suites