diff -up ./python2/httplib2/__init__.py.orig ./python2/httplib2/__init__.py --- ./python2/httplib2/__init__.py.orig 2012-05-03 17:09:12.836155079 +1000 +++ ./python2/httplib2/__init__.py 2012-05-03 17:10:02.149780584 +1000 @@ -942,11 +942,12 @@ class HTTPSConnectionWithTimeout(httplib list: A list of valid host globs. """ if 'subjectAltName' in cert: - return [x[1] for x in cert['subjectAltName'] - if x[0].lower() == 'dns'] - else: - return [x[0][1] for x in cert['subject'] - if x[0][0].lower() == 'commonname'] + for x in cert['subjectAltName']: + if x[0].lower() == 'dns': + return x[1] + + return [x[0][1] for x in cert['subject'] + if x[0][0].lower() == 'commonname'] def _ValidateCertificateHostname(self, cert, hostname): """Validates that a given hostname is valid for an SSL certificate.