Commit c6f302b0 authored by Lucas Carvalho's avatar Lucas Carvalho

Typo.

parent 68f4c30a
...@@ -68,11 +68,12 @@ class HTTPSConnectionCertificateVerification(httplib.HTTPSConnection): ...@@ -68,11 +68,12 @@ class HTTPSConnectionCertificateVerification(httplib.HTTPSConnection):
ca_certs=self.ssl_cert_path, ca_certs=self.ssl_cert_path,
cert_reqs=ssl.CERT_REQUIRED) cert_reqs=ssl.CERT_REQUIRED)
cert = self.sock.getpeercert() cert = self.sock.getpeercert()
for field in cert['subject']: if cert:
if field[0][0] == 'commonName': for field in cert['subject']:
certhost = field[0][1] if field[0][0] == 'commonName':
if certhost != self.host: certhost = field[0][1]
raise ssl.SSLError(\ if certhost != self.host:
raise ssl.SSLError(\
"Host name '%s' doesn't match with the certificate host '%s'" "Host name '%s' doesn't match with the certificate host '%s'"
% (self.host, certhost)) % (self.host, certhost))
...@@ -90,7 +91,7 @@ class VerifiedHTTPSHandler(urllib2.HTTPSHandler): ...@@ -90,7 +91,7 @@ class VerifiedHTTPSHandler(urllib2.HTTPSHandler):
def install_opener_director(info_dict): def install_opener_director(info_dict):
if info_dict.get('schema') in ('https',): if info_dict.get('scheme') in ('https',):
https_handler = VerifiedHTTPSHandler() https_handler = VerifiedHTTPSHandler()
url_opener = urllib2.build_opener(https_handler) url_opener = urllib2.build_opener(https_handler)
urllib2.install_opener(url_opener) urllib2.install_opener(url_opener)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment