aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/tcp.py
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2015-06-15 17:31:08 +0200
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2015-06-16 15:00:28 +0200
commitabb37a3ef52ab9a0f68dc46e4a8ca165e365139b (patch)
treeff569a1321eb3cef327d9e5f5843840a577eaeb1 /netlib/tcp.py
parent20c136e070cee0e93e870bf32199cb36b1b85275 (diff)
downloadmitmproxy-abb37a3ef52ab9a0f68dc46e4a8ca165e365139b.tar.gz
mitmproxy-abb37a3ef52ab9a0f68dc46e4a8ca165e365139b.tar.bz2
mitmproxy-abb37a3ef52ab9a0f68dc46e4a8ca165e365139b.zip
http2: improve test suite
Diffstat (limited to 'netlib/tcp.py')
-rw-r--r--netlib/tcp.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/netlib/tcp.py b/netlib/tcp.py
index 2e847d83..cafc3ed9 100644
--- a/netlib/tcp.py
+++ b/netlib/tcp.py
@@ -414,6 +414,9 @@ class _Connection(object):
if cipher_list:
try:
context.set_cipher_list(cipher_list)
+
+ # TODO: maybe change this to with newer pyOpenSSL APIs
+ context.set_tmp_ecdh(OpenSSL.crypto.get_elliptic_curve('prime256v1'))
except SSL.Error as v:
raise NetLibError("SSL cipher specification error: %s" % str(v))
@@ -421,8 +424,6 @@ class _Connection(object):
if log_ssl_key:
context.set_info_callback(log_ssl_key)
- context.set_tmp_ecdh(OpenSSL.crypto.get_elliptic_curve('prime256v1'))
-
if OpenSSL._util.lib.Cryptography_HAS_ALPN:
if alpn_protos is not None:
# advertise application layer protocols
@@ -526,7 +527,7 @@ class TCPClient(_Connection):
if OpenSSL._util.lib.Cryptography_HAS_ALPN and self.ssl_established:
return self.connection.get_alpn_proto_negotiated()
else:
- return None
+ return ""
class BaseHandler(_Connection):
@@ -636,7 +637,7 @@ class BaseHandler(_Connection):
if OpenSSL._util.lib.Cryptography_HAS_ALPN and self.ssl_established:
return self.connection.get_alpn_proto_negotiated()
else:
- return None
+ return ""
class TCPServer(object):