aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/protocol/tls.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2015-09-11 00:00:00 +0200
committerMaximilian Hils <git@maximilianhils.com>2015-09-11 00:00:00 +0200
commitd1bc966e5b7e2ef822443f3ad28a5f3d40965e75 (patch)
tree3468125e5579adce3295b4055012c329ebc6d27a /libmproxy/protocol/tls.py
parent33c0d3653077c9e6834034ec03a42beeba3ca7d7 (diff)
downloadmitmproxy-d1bc966e5b7e2ef822443f3ad28a5f3d40965e75.tar.gz
mitmproxy-d1bc966e5b7e2ef822443f3ad28a5f3d40965e75.tar.bz2
mitmproxy-d1bc966e5b7e2ef822443f3ad28a5f3d40965e75.zip
polish for release: introduce http2 and rawtcp as command line switches
Diffstat (limited to 'libmproxy/protocol/tls.py')
-rw-r--r--libmproxy/protocol/tls.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/libmproxy/protocol/tls.py b/libmproxy/protocol/tls.py
index 6e8535ae..2cddb1dd 100644
--- a/libmproxy/protocol/tls.py
+++ b/libmproxy/protocol/tls.py
@@ -3,6 +3,8 @@ from __future__ import (absolute_import, print_function, division)
import struct
from construct import ConstructError
+import six
+import sys
from netlib.tcp import NetLibError, NetLibInvalidCertificateError
from netlib.http.http1 import HTTP1Protocol
@@ -387,7 +389,7 @@ class TlsLayer(Layer):
self._establish_tls_with_client()
except:
pass
- raise e
+ six.reraise(*sys.exc_info())
self._establish_tls_with_client()
@@ -416,9 +418,11 @@ class TlsLayer(Layer):
# and mitmproxy would enter TCP passthrough mode, which we want to avoid.
deprecated_http2_variant = lambda x: x.startswith("h2-") or x.startswith("spdy")
if self.client_alpn_protocols:
- alpn = filter(lambda x: not deprecated_http2_variant(x), self.client_alpn_protocols)
+ alpn = [x for x in self.client_alpn_protocols if not deprecated_http2_variant(x)]
else:
alpn = None
+ if alpn and "h2" in alpn and not self.config.http2 :
+ alpn.remove("h2")
ciphers_server = self.config.ciphers_server
if not ciphers_server: