From 4c76345338239ed759cd521f979d8c07617cc0b8 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Wed, 19 Mar 2014 17:16:42 +0100 Subject: [PATCH] Add certificate valid date info and always set verify flag. --- linkcheck/checker/httpurl.py | 14 ++++---------- linkcheck/plugins/sslcertcheck.py | 4 ++++ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/linkcheck/checker/httpurl.py b/linkcheck/checker/httpurl.py index f8f899c7..c1579ed7 100644 --- a/linkcheck/checker/httpurl.py +++ b/linkcheck/checker/httpurl.py @@ -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': diff --git a/linkcheck/plugins/sslcertcheck.py b/linkcheck/plugins/sslcertcheck.py index 505210b3..f2187acf 100644 --- a/linkcheck/plugins/sslcertcheck.py +++ b/linkcheck/plugins/sslcertcheck.py @@ -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):