diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2014-09-29 21:14:51 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2014-09-29 21:14:51 -0400 |
commit | 626fa69fb0470710e870628afd0cb7ec0ba96ddf (patch) | |
tree | befcacc09c560133266eb5a1757a45ea43d93453 /setuptools/ssl_support.py | |
parent | 96aed21b42121acde68dd6b3732c3fbae0903569 (diff) | |
parent | 9e7f35fec4178dea678693cb768b6076d45e7ddd (diff) | |
download | external_python_setuptools-626fa69fb0470710e870628afd0cb7ec0ba96ddf.tar.gz external_python_setuptools-626fa69fb0470710e870628afd0cb7ec0ba96ddf.tar.bz2 external_python_setuptools-626fa69fb0470710e870628afd0cb7ec0ba96ddf.zip |
Merge with 6.0.2
--HG--
branch : feature/issue-229
Diffstat (limited to 'setuptools/ssl_support.py')
-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 b574f4b9..c618ea7c 100644 --- a/setuptools/ssl_support.py +++ b/setuptools/ssl_support.py @@ -173,12 +173,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() |