a5fc66
diff -up ./python2/httplib2/__init__.py.orig ./python2/httplib2/__init__.py
a5fc66
--- ./python2/httplib2/__init__.py.orig	2012-07-27 18:35:59.215300471 +1000
a5fc66
+++ ./python2/httplib2/__init__.py	2012-07-27 18:36:30.697287505 +1000
a5fc66
@@ -943,8 +943,13 @@ class HTTPSConnectionWithTimeout(httplib
a5fc66
         """
a5fc66
         if 'subjectAltName' in cert:
a5fc66
             # Patch from richardfearn@gmail.com
a5fc66
-	    return [x[1] for x in cert['subjectAltName']
a5fc66
+            # RFC 2459 states that subjectAltName may contain:
a5fc66
+            # either DNS, email, IP or URI
a5fc66
+            # email, URI,
a5fc66
+            hosts=[x[1] for x in cert['subjectAltName']
a5fc66
                 if x[0].lower() == "dns"]
a5fc66
+	    if hosts:
a5fc66
+		return hosts
a5fc66
a5fc66
         return [x[0][1] for x in cert['subject']
a5fc66
             if x[0][0].lower() == 'commonname']
a5fc66