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