summaryrefslogtreecommitdiff
path: root/https_wrapper.py
diff options
context:
space:
mode:
Diffstat (limited to 'https_wrapper.py')
-rw-r--r--https_wrapper.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/https_wrapper.py b/https_wrapper.py
index 94c0c8a..d798513 100644
--- a/https_wrapper.py
+++ b/https_wrapper.py
@@ -118,7 +118,8 @@ class CertValidatingHTTPSConnection(httplib.HTTPConnection):
ca_certs=self.ca_certs)
if self.cert_reqs & ssl.CERT_REQUIRED:
cert = self.sock.getpeercert()
- hostname = self.host.split(':', 0)[0]
+ cert_validation_host = self._tunnel_host or self.host
+ hostname = cert_validation_host.split(':', 0)[0]
if not self._ValidateCertificateHostname(cert, hostname):
raise InvalidCertificateException(hostname, cert, 'hostname mismatch')