[httplib2] push by joe.gregorio - Fix issue with not matching on first host in cert list. Add unit tests... on 2011-06-23 12:57 GMT

7 views
Skip to first unread message

codesite...@google.com

unread,
Jun 23, 2011, 8:57:46 AM6/23/11
to httplib...@googlegroups.com
Revision: adfecbabd3f9
Author: Joe Gregorio <jcgre...@google.com>
Date: Thu Jun 23 05:56:59 2011
Log: Fix issue with not matching on first host in cert list. Add unit
tests.
http://code.google.com/p/httplib2/source/detail?r=adfecbabd3f9

Modified:
/python2/httplib2/__init__.py
/python2/httplib2test.py

=======================================
--- /python2/httplib2/__init__.py Wed Jun 22 13:55:52 2011
+++ /python2/httplib2/__init__.py Thu Jun 23 05:56:59 2011
@@ -869,7 +869,7 @@
host_re = host.replace('.', '\.').replace('*', '[^.]*')
if re.search('^%s$' % (host_re,), hostname, re.I):
return True
- return False
+ return False

def connect(self):
"Connect to a host on a given (SSL) port."
=======================================
--- /python2/httplib2test.py Wed Jun 22 13:55:52 2011
+++ /python2/httplib2test.py Thu Jun 23 05:56:59 2011
@@ -482,6 +482,14 @@
self.assertRaises(httplib2.SSLHandshakeError,
http.request, "https://www.google.com/", "GET")

+ def testSslCertValidationDoubleDots(self):
+ if sys.version_info >= (2, 6):
+ # Test that we get match a double dot cert
+ try:
+ self.http.request("https://1.www.appspot.com/", "GET")
+ except httplib2.CertificateHostnameMismatch:
+ self.fail('cert with *.*.appspot.com should not raise an
exception.')
+
def testSslHostnameValidation(self):
if sys.version_info >= (2, 6):
# The SSL server at google.com:443 returns a certificate for

Reply all
Reply to author
Forward
0 new messages