diff --git a/mitmproxy/addons/tlsconfig.py b/mitmproxy/addons/tlsconfig.py index c6e62a510..d1c8f5551 100644 --- a/mitmproxy/addons/tlsconfig.py +++ b/mitmproxy/addons/tlsconfig.py @@ -1,6 +1,6 @@ import os from pathlib import Path -from typing import List, Optional, Tuple, TypedDict, Union, Any +from typing import List, Optional, Tuple, TypedDict, Any from OpenSSL import SSL, crypto from mitmproxy import certs, ctx, exceptions diff --git a/mitmproxy/net/tls.py b/mitmproxy/net/tls.py index 27339396b..473a83ef5 100644 --- a/mitmproxy/net/tls.py +++ b/mitmproxy/net/tls.py @@ -22,8 +22,8 @@ class Method(Enum): # TODO: remove once https://github.com/pyca/pyopenssl/pull/985 has landed. -SSL.Context._methods.setdefault(Method.TLS_SERVER_METHOD.value, "TLS_server_method") -SSL.Context._methods.setdefault(Method.TLS_CLIENT_METHOD.value, "TLS_client_method") +SSL.Context._methods.setdefault(Method.TLS_SERVER_METHOD.value, SSL._lib.TLS_server_method) +SSL.Context._methods.setdefault(Method.TLS_CLIENT_METHOD.value, SSL._lib.TLS_client_method) class Version(Enum): diff --git a/mitmproxy/options.py b/mitmproxy/options.py index bc300b23a..a047358bb 100644 --- a/mitmproxy/options.py +++ b/mitmproxy/options.py @@ -1,8 +1,6 @@ from typing import Optional, Sequence from mitmproxy import optmanager -from mitmproxy.net import tls - CONF_DIR = "~/.mitmproxy" CONF_BASENAME = "mitmproxy" diff --git a/test/mitmproxy/net/test_tls.py b/test/mitmproxy/net/test_tls.py index a64b84f1f..6b843c811 100644 --- a/test/mitmproxy/net/test_tls.py +++ b/test/mitmproxy/net/test_tls.py @@ -1,8 +1,3 @@ -import io - -import pytest - -from mitmproxy import exceptions from mitmproxy.net import tls CLIENT_HELLO_NO_EXTENSIONS = bytes.fromhex( @@ -11,9 +6,9 @@ CLIENT_HELLO_NO_EXTENSIONS = bytes.fromhex( "61006200640100" ) FULL_CLIENT_HELLO_NO_EXTENSIONS = ( - b"\x16\x03\x03\x00\x65" # record layer - b"\x01\x00\x00\x61" + # handshake header - CLIENT_HELLO_NO_EXTENSIONS + b"\x16\x03\x03\x00\x65" # record layer + b"\x01\x00\x00\x61" + # handshake header + CLIENT_HELLO_NO_EXTENSIONS )