diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2020-03-07 15:41:51 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2020-03-07 15:41:51 -0500 |
commit | da94b05088d9bddb6ba0cd5a1b236e99985816c0 (patch) | |
tree | 8a78ccd2d459e7702d914cb35e29f5f661e5bf5a /setuptools/ssl_support.py | |
parent | 6980b9c8fed113f1046099924e16287662beff5f (diff) | |
parent | 25edd1951d8d44c34578c926f5c20ed3d452587b (diff) | |
download | external_python_setuptools-da94b05088d9bddb6ba0cd5a1b236e99985816c0.tar.gz external_python_setuptools-da94b05088d9bddb6ba0cd5a1b236e99985816c0.tar.bz2 external_python_setuptools-da94b05088d9bddb6ba0cd5a1b236e99985816c0.zip |
Merge remote-tracking branch 'origin/master' into debt/remove-features
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 ) |