void-packages/srcpkgs/python-httplib2/patches/ssl-mismatch-check.patch
Alessio Sergi 28a1d66a84 python-httplib2: update to 0.9
Switch to setuptools.
Add python3.4 subpkg with pycompile support.
Add patch to use system ca certificates, via Debian.
2014-07-01 12:47:27 +02:00

25 lines
1.2 KiB
Diff

Description: Close connection on certificate mismatch to avoid reuse
Author: Roman Podolyaka <rpodolyaka...mirantis.com>
Forwarded: https://code.google.com/p/httplib2/issues/detail?id=282
diff -r 93291649202b python2/httplib2/__init__.py
--- a/python2/httplib2/__init__.py Tue Mar 26 14:17:48 2013 -0400
+++ b/python2/httplib2/__init__.py Tue Apr 23 10:32:15 2013 +0300
@@ -1030,7 +1030,7 @@
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:
@@ -1040,7 +1040,7 @@
# 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