From c74690a79a8346a25c0aaca3cfeb2ce45ef04a5e Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Fri, 10 Aug 2012 19:43:57 +0200 Subject: [PATCH] Do not check SSl certificates on HTTPS -> HTTP redirects. --- linkcheck/checker/httpsurl.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/linkcheck/checker/httpsurl.py b/linkcheck/checker/httpsurl.py index 61f54c5a..806f48ea 100644 --- a/linkcheck/checker/httpsurl.py +++ b/linkcheck/checker/httpsurl.py @@ -44,9 +44,12 @@ class HttpsUrl (httpurl.HttpUrl): return h def check_ssl_certificate(self, ssl_sock, host): - """Run all SSl certificate checks that have not yet been done. + """Run all SSL certificate checks that have not yet been done. OpenSSL already checked the SSL notBefore and notAfter dates. """ + if not hasattr(ssl_sock, "getpeercert"): + # the URL was a HTTPS -> HTTP redirect + return cert = ssl_sock.getpeercert() log.debug(LOG_CHECK, "Got SSL certificate %s", cert) if not cert: