only log cert errors if not handled by user

This commit is contained in:
Jay Farrimond 2012-07-05 13:30:33 -07:00 committed by Lance Stout
parent a26a8bd79c
commit 88b5e60807

View file

@ -537,8 +537,8 @@ class XMLStream(object):
try: try:
cert.verify(self._expected_server_name, self._der_cert) cert.verify(self._expected_server_name, self._der_cert)
except cert.CertificateError as err: except cert.CertificateError as err:
log.error(err.message)
if not self.event_handled('ssl_invalid_cert'): if not self.event_handled('ssl_invalid_cert'):
log.error(err.message)
self.disconnect(send_close=False) self.disconnect(send_close=False)
else: else:
self.event('ssl_invalid_cert', self.event('ssl_invalid_cert',
@ -828,8 +828,8 @@ class XMLStream(object):
try: try:
cert.verify(self._expected_server_name, self._der_cert) cert.verify(self._expected_server_name, self._der_cert)
except cert.CertificateError as err: except cert.CertificateError as err:
log.error(err.message)
if not self.event_handled('ssl_invalid_cert'): if not self.event_handled('ssl_invalid_cert'):
log.error(err.message)
self.disconnect(self.auto_reconnect, send_close=False) self.disconnect(self.auto_reconnect, send_close=False)
else: else:
self.event('ssl_invalid_cert', pem_cert, direct=True) self.event('ssl_invalid_cert', pem_cert, direct=True)