mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-25 09:37:37 +00:00
Remove pyopenssl cruft (#4897)
* remove old pyopenssl cruft * bump minimum version of pyopenssl * add extra spaces to conform to style guide * update changelog * replace getattr with direct SSL method calls * put version check back in but remove setdefault method calls * tweak changelog wording * bumb tox.ini pyOpenSSL dependency version Co-authored-by: Karl Parkinson <karlparkinson@Karls-MBP.hitronhub.home>
This commit is contained in:
parent
fd5caf40c7
commit
df32d61086
@ -14,6 +14,7 @@
|
||||
* Fix a crash caused when editing string option (#4852, @rbdixon)
|
||||
* Base container image bumped to Debian 11 Bullseye (@Kriechi)
|
||||
* Upstream replays don't do CONNECT on plaintext HTTP requests (#4876, @HoffmannP)
|
||||
* Remove workarounds for old pyOpenSSL versions (#4831, @KarlParkinson)
|
||||
|
||||
## 28 September 2021: mitmproxy 7.0.4
|
||||
|
||||
|
@ -21,29 +21,23 @@ from mitmproxy.net import check
|
||||
|
||||
# redeclared here for strict type checking
|
||||
class Method(Enum):
|
||||
# TODO: just SSL attributes once https://github.com/pyca/pyopenssl/pull/985 has landed.
|
||||
TLS_SERVER_METHOD = getattr(SSL, "TLS_SERVER_METHOD", 8)
|
||||
TLS_CLIENT_METHOD = getattr(SSL, "TLS_CLIENT_METHOD", 9)
|
||||
TLS_SERVER_METHOD = SSL.TLS_SERVER_METHOD
|
||||
TLS_CLIENT_METHOD = SSL.TLS_CLIENT_METHOD
|
||||
|
||||
|
||||
# TODO: remove once https://github.com/pyca/pyopenssl/pull/985 has landed.
|
||||
try:
|
||||
SSL._lib.TLS_server_method # type: ignore
|
||||
except AttributeError as e: # pragma: no cover
|
||||
raise RuntimeError("Your installation of the cryptography Python package is outdated.") from e
|
||||
|
||||
SSL.Context._methods.setdefault(Method.TLS_SERVER_METHOD.value, SSL._lib.TLS_server_method) # type: ignore
|
||||
SSL.Context._methods.setdefault(Method.TLS_CLIENT_METHOD.value, SSL._lib.TLS_client_method) # type: ignore
|
||||
|
||||
|
||||
class Version(Enum):
|
||||
UNBOUNDED = 0
|
||||
# TODO: just SSL attributes once https://github.com/pyca/pyopenssl/pull/985 has landed.
|
||||
SSL3 = getattr(SSL, "SSL3_VERSION", 768)
|
||||
TLS1 = getattr(SSL, "TLS1_VERSION", 769)
|
||||
TLS1_1 = getattr(SSL, "TLS1_1_VERSION", 770)
|
||||
TLS1_2 = getattr(SSL, "TLS1_2_VERSION", 771)
|
||||
TLS1_3 = getattr(SSL, "TLS1_3_VERSION", 772)
|
||||
SSL3 = SSL.SSL3_VERSION
|
||||
TLS1 = SSL.TLS1_VERSION
|
||||
TLS1_1 = SSL.TLS1_1_VERSION
|
||||
TLS1_2 = SSL.TLS1_2_VERSION
|
||||
TLS1_3 = SSL.TLS1_3_VERSION
|
||||
|
||||
|
||||
class Verify(Enum):
|
||||
|
2
setup.py
2
setup.py
@ -82,7 +82,7 @@ setup(
|
||||
"msgpack>=1.0.0, <1.1.0",
|
||||
"passlib>=1.6.5, <1.8",
|
||||
"protobuf>=3.14,<3.19",
|
||||
"pyOpenSSL>=20.0,<21.1",
|
||||
"pyOpenSSL>=21.0,<21.1",
|
||||
"pyparsing>=2.4.2,<2.5",
|
||||
"pyperclip>=1.6.0,<1.9",
|
||||
"ruamel.yaml>=0.16,<0.17.17",
|
||||
|
Loading…
Reference in New Issue
Block a user