diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2020-05-24 16:40:40 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2020-05-24 16:40:40 -0400 |
| commit | 7306811598b51bfe726850ce4b061a6e389d5b80 (patch) | |
| tree | 907882aecc017d26f925f70d003371124a507d0f /setuptools/ssl_support.py | |
| parent | 8f1f09b7f93f2fa86bafcd6502ec51d4680b4499 (diff) | |
| parent | 52c394c1e87b863aec92949e4b494ab01a7cd234 (diff) | |
| download | python-setuptools-git-7306811598b51bfe726850ce4b061a6e389d5b80.tar.gz | |
Merge branch 'master' into docs_ci
Diffstat (limited to 'setuptools/ssl_support.py')
| -rw-r--r-- | setuptools/ssl_support.py | 23 |
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 ) |
