diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2014-07-06 13:58:54 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2014-07-06 13:58:54 -0400 |
commit | cde14ad10eec5bc2e8fc0af24125f58c91e0fbcc (patch) | |
tree | 57bc205cc15d8489813b249b4591b1d9c596adb7 | |
parent | 26d4bb13598407c64ab1a77a33716411c5fbad3f (diff) | |
parent | bf0cecd76dd0501cbb98c77583c11a622dcfe73f (diff) | |
download | external_python_setuptools-cde14ad10eec5bc2e8fc0af24125f58c91e0fbcc.tar.gz external_python_setuptools-cde14ad10eec5bc2e8fc0af24125f58c91e0fbcc.tar.bz2 external_python_setuptools-cde14ad10eec5bc2e8fc0af24125f58c91e0fbcc.zip |
Merged in rakuco/setuptools (pull request #71)
ssl_support: Adjust to tunneling changes in Python 2.7.7 and 3.4.1.
-rw-r--r-- | setuptools/ssl_support.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/setuptools/ssl_support.py b/setuptools/ssl_support.py index 7b5f429f..cc7db067 100644 --- a/setuptools/ssl_support.py +++ b/setuptools/ssl_support.py @@ -178,12 +178,19 @@ class VerifyingHTTPSConn(HTTPSConnection): if hasattr(self, '_tunnel') and getattr(self, '_tunnel_host', None): self.sock = sock self._tunnel() + # http://bugs.python.org/issue7776: Python>=3.4.1 and >=2.7.7 + # change self.host to mean the proxy server host when tunneling is + # being used. Adapt, since we are interested in the destination + # host for the match_hostname() comparison. + actual_host = self._tunnel_host + else: + actual_host = self.host self.sock = ssl.wrap_socket( sock, cert_reqs=ssl.CERT_REQUIRED, ca_certs=self.ca_bundle ) try: - match_hostname(self.sock.getpeercert(), self.host) + match_hostname(self.sock.getpeercert(), actual_host) except CertificateError: self.sock.shutdown(socket.SHUT_RDWR) self.sock.close() |