summaryrefslogtreecommitdiff
path: root/setuptools/ssl_support.py
diff options
context:
space:
mode:
authorJohannes Reiff <mail@jreiff.de>2020-01-25 14:17:40 +0100
committerGitHub <noreply@github.com>2020-01-25 14:17:40 +0100
commit6ee1a1ce60c6d039c63def3c2aeba7e0f39e7507 (patch)
tree254243b04be614ee4ea346ccb7c25fb9deb11f5f /setuptools/ssl_support.py
parentec270f9e13fcc32a2a861273219ebfeba17838df (diff)
parent73376585065bbf28395c71fe15137c19a712d4f3 (diff)
downloadpython-setuptools-git-6ee1a1ce60c6d039c63def3c2aeba7e0f39e7507.tar.gz
Merge branch 'master' into pr-easyinstall
Diffstat (limited to 'setuptools/ssl_support.py')
-rw-r--r--setuptools/ssl_support.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/setuptools/ssl_support.py b/setuptools/ssl_support.py
index 226db694..17c14c46 100644
--- a/setuptools/ssl_support.py
+++ b/setuptools/ssl_support.py
@@ -35,7 +35,8 @@ try:
except AttributeError:
HTTPSHandler = HTTPSConnection = object
-is_available = ssl is not None and object not in (HTTPSHandler, HTTPSConnection)
+is_available = ssl is not None and object not in (
+ HTTPSHandler, HTTPSConnection)
try:
@@ -85,8 +86,10 @@ if not match_hostname:
return dn.lower() == hostname.lower()
# RFC 6125, section 6.4.3, subitem 1.
- # The client SHOULD NOT attempt to match a presented identifier in which
- # the wildcard character comprises a label other than the left-most label.
+ # The client SHOULD NOT attempt to match a
+ # presented identifier in which the wildcard
+ # character comprises a label other than the
+ # left-most label.
if leftmost == '*':
# When '*' is a fragment by itself, it matches a non-empty dotless
# fragment.
@@ -137,15 +140,16 @@ if not match_hostname:
return
dnsnames.append(value)
if len(dnsnames) > 1:
- raise CertificateError("hostname %r "
- "doesn't match either of %s"
+ raise CertificateError(
+ "hostname %r doesn't match either of %s"
% (hostname, ', '.join(map(repr, dnsnames))))
elif len(dnsnames) == 1:
- raise CertificateError("hostname %r "
- "doesn't match %r"
+ raise CertificateError(
+ "hostname %r doesn't match %r"
% (hostname, dnsnames[0]))
else:
- raise CertificateError("no appropriate commonName or "
+ raise CertificateError(
+ "no appropriate commonName or "
"subjectAltName fields were found")
@@ -158,7 +162,8 @@ class VerifyingHTTPSHandler(HTTPSHandler):
def https_open(self, req):
return self.do_open(
- lambda host, **kw: VerifyingHTTPSConn(host, self.ca_bundle, **kw), req
+ lambda host, **kw: VerifyingHTTPSConn(host, self.ca_bundle, **kw),
+ req
)