[Python-modules-commits] [python-httplib2] 04/10: Close connection on certificate mismatch to avoid reuse

Scott Kitterman kitterman at moszumanska.debian.org
Wed Nov 9 21:34:20 UTC 2016


This is an automated email from the git hooks/post-receive script.

kitterman pushed a commit to branch master
in repository python-httplib2.

commit 871c40f5144e27d0344734cff78806d925a96d38
Author: Roman Podolyaka <rpodolyaka...mirantis.com>
Date:   Thu Oct 8 12:15:45 2015 -0700

    Close connection on certificate mismatch to avoid reuse
    
    Forwarded: https://code.google.com/p/httplib2/issues/detail?id=282
    
    Patch-Name: ssl-mismatch-check.patch
---
 python2/httplib2/__init__.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/python2/httplib2/__init__.py b/python2/httplib2/__init__.py
index e996d01..4564991 100644
--- a/python2/httplib2/__init__.py
+++ b/python2/httplib2/__init__.py
@@ -1044,7 +1044,7 @@ class HTTPSConnectionWithTimeout(httplib.HTTPSConnection):
                         raise CertificateHostnameMismatch(
                             'Server presented certificate that does not match '
                             'host %s: %s' % (hostname, cert), hostname, cert)
-            except ssl_SSLError, e:
+            except (ssl_SSLError, CertificateHostnameMismatch), e:
                 if sock:
                     sock.close()
                 if self.sock:
@@ -1054,7 +1054,7 @@ class HTTPSConnectionWithTimeout(httplib.HTTPSConnection):
                 # to get at more detailed error information, in particular
                 # whether the error is due to certificate validation or
                 # something else (such as SSL protocol mismatch).
-                if e.errno == ssl.SSL_ERROR_SSL:
+                if hasattr(e, 'errno') and e.errno == ssl.SSL_ERROR_SSL:
                     raise SSLHandshakeError(e)
                 else:
                     raise

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-httplib2.git



More information about the Python-modules-commits mailing list