diff options
| author | Joe Gregorio <jcgregorio@google.com> | 2011-06-23 08:56:59 -0400 |
|---|---|---|
| committer | Joe Gregorio <jcgregorio@google.com> | 2011-06-23 08:56:59 -0400 |
| commit | c69dc7821e789307641394b6385f89bb1788ba64 (patch) | |
| tree | f1c3d68dd1ea47fa32bcb5cfbaf953c37c048306 /python2 | |
| parent | 03d9910cc44e33ae7a325189b0f9d4d6f16e4875 (diff) | |
| download | httplib2-c69dc7821e789307641394b6385f89bb1788ba64.tar.gz | |
Fix issue with not matching on first host in cert list. Add unit tests.
Diffstat (limited to 'python2')
| -rw-r--r-- | python2/httplib2/__init__.py | 2 | ||||
| -rwxr-xr-x | python2/httplib2test.py | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/python2/httplib2/__init__.py b/python2/httplib2/__init__.py index f210130..bbf6f79 100644 --- a/python2/httplib2/__init__.py +++ b/python2/httplib2/__init__.py @@ -869,7 +869,7 @@ class HTTPSConnectionWithTimeout(httplib.HTTPSConnection): 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." diff --git a/python2/httplib2test.py b/python2/httplib2test.py index bb9a32c..2869b6b 100755 --- a/python2/httplib2test.py +++ b/python2/httplib2test.py @@ -482,6 +482,14 @@ class HttpTest(unittest.TestCase): 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 |
