Add certificate valid date info and always set verify flag.

This commit is contained in:
Bastian Kleineidam 2014-03-19 17:16:42 +01:00
parent 9a7ad3a84f
commit 4c76345338
2 changed files with 8 additions and 10 deletions

View file

@ -163,20 +163,14 @@ class HttpUrl (internpaturl.InternPatternUrl, proxysupport.ProxySupport):
allow_redirects=False,
)
if self.scheme == u"https" and self.aggregate.config["sslverify"]:
kwargs["verify"] = self.aggregate.config["sslverify"]
log.debug(LOG_CHECK, "Send request with %s", kwargs)
try:
self._send_request(request, **kwargs)
except requests.exceptions.SSLError:
# provide non-validated connection info
del kwargs["verify"]
self._send_request(request, **kwargs)
raise
kwargs['verify'] = self.aggregate.config["sslverify"]
else:
self._send_request(request, **kwargs)
kwargs['verify'] = False
self._send_request(request, **kwargs)
def _send_request(self, request, **kwargs):
"""Send GET request."""
log.debug(LOG_CHECK, "Send request with %s", kwargs)
self.url_connection = self.session.send(request, **kwargs)
self.headers = self.url_connection.headers
if self.scheme == u'https':

View file

@ -91,6 +91,10 @@ class SslCertificateCheck(_ConnectionPlugin):
strTimeValid = strformat.strduration_long(secondsValid)
msg = _('SSL certificate is only %s valid') % strTimeValid
url_data.add_warning(msg)
else:
strTimeValid = strformat.strduration_long(secondsValid)
msg = _('SSL certificate is %s valid') % strTimeValid
url_data.add_info(msg)
@classmethod
def read_config(cls, configparser):