Skip to content

Commit

Permalink
deps: remove backports.ssl_match_hostname (#3011)
Browse files Browse the repository at this point in the history
This is no longer needed as it exists in every supported (non-EOL)
version of Python that we target.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
  • Loading branch information
milas committed Jul 27, 2022
1 parent da62a28 commit 52e29bd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 19 deletions.
8 changes: 0 additions & 8 deletions docker/transport/ssladapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
https://lukasa.co.uk/2013/01/Choosing_SSL_Version_In_Requests/
https://github.com/kennethreitz/requests/pull/799
"""
import sys

from packaging.version import Version
from requests.adapters import HTTPAdapter

Expand All @@ -17,12 +15,6 @@

PoolManager = urllib3.poolmanager.PoolManager

# Monkey-patching match_hostname with a version that supports
# IP-address checking. Not necessary for Python 3.5 and above
if sys.version_info[0] < 3 or sys.version_info[1] < 5:
from backports.ssl_match_hostname import match_hostname
urllib3.connection.match_hostname = match_hostname


class SSLHTTPAdapter(BaseHTTPAdapter):
'''An HTTPS Transport Adapter that uses an arbitrary SSL version.'''
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
appdirs==1.4.3
asn1crypto==0.22.0
backports.ssl-match-hostname==3.5.0.1
cffi==1.14.4
cryptography==3.4.7
enum34==1.1.6
Expand Down
13 changes: 3 additions & 10 deletions tests/unit/ssladapter_test.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import unittest
from docker.transport import ssladapter
import pytest
from ssl import match_hostname, CertificateError

try:
from backports.ssl_match_hostname import (
match_hostname, CertificateError
)
except ImportError:
from ssl import (
match_hostname, CertificateError
)
import pytest
from docker.transport import ssladapter

try:
from ssl import OP_NO_SSLv3, OP_NO_SSLv2, OP_NO_TLSv1
Expand Down

0 comments on commit 52e29bd

Please sign in to comment.