Sophie

Sophie

distrib > Mageia > 9 > aarch64 > media > core-release-src > by-pkgid > 2cf57945e523eb1a9fa7d90302823140 > files > 5

python-httplib2-0.20.4-1.mga9.src.rpm

--- httplib2-0.12.0/python2/httplib2/__init__.py.rfc2459	2019-01-13 22:52:11.833382744 -0500
+++ httplib2-0.12.0/python2/httplib2/__init__.py	2019-01-13 22:56:43.745405887 -0500
@@ -1294,9 +1294,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"]
+            # RFC 2459 states that subjectAltName may contain DNS, email, IP, or URI
+            hosts=[x[1] for x in cert["subjectAltName"] if x[0].lower() == "dns"]
+        if hosts:
+            return hosts
+
+        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.