Add host:port printing to SSL/TLS connection errors

This commit is contained in:
Fabian Ising 2022-09-12 13:20:23 +02:00
parent dc994aaa17
commit c2cd94fcaa

View File

@ -86,7 +86,7 @@ class HTTPSConnection(_http_client.HTTPSConnection):
sock.close() sock.close()
except (ssl.SSLError, socket.error, _http_client.BadStatusLine) as ex: except (ssl.SSLError, socket.error, _http_client.BadStatusLine) as ex:
self._tunnel_host = None self._tunnel_host = None
logger.debug("SSL connection error occurred for '%s' ('%s')" % (_lut[protocol], getSafeExString(ex))) logger.debug("SSL connection error occurred for '%s' on '%s:%d' ('%s')" % (_lut[protocol], self.host, self.port, getSafeExString(ex)))
if kb.tlsSNI.get(self.host) is None: if kb.tlsSNI.get(self.host) is None:
kb.tlsSNI[self.host] = success kb.tlsSNI[self.host] = success
@ -106,7 +106,7 @@ class HTTPSConnection(_http_client.HTTPSConnection):
sock.close() sock.close()
except (ssl.SSLError, socket.error, _http_client.BadStatusLine) as ex: except (ssl.SSLError, socket.error, _http_client.BadStatusLine) as ex:
self._tunnel_host = None self._tunnel_host = None
logger.debug("SSL connection error occurred for '%s' ('%s')" % (_lut[protocol], getSafeExString(ex))) logger.debug("SSL connection error occurred for '%s' on '%s:%d' ('%s')" % (_lut[protocol], self.host, self.port, getSafeExString(ex)))
if not success: if not success:
errMsg = "can't establish SSL connection" errMsg = "can't establish SSL connection"