From 346bfcd9ef93c4bc9d6bebfba9608016c96e5a25 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Wed, 5 Jan 2011 08:45:14 +0000 Subject: [PATCH] Support https links Also, allow up to three redirections. Closes #3150644. --- feedlint | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/feedlint b/feedlint index cce388a..cea5f5a 100755 --- a/feedlint +++ b/feedlint @@ -94,11 +94,15 @@ def check_key(feed, fingerprint): result('OK') checked.add(key_url) -def get_http_size(url, ttl = 1): - assert url.lower().startswith('http://') - +def get_http_size(url, ttl = 3): address = urlparse.urlparse(url) - http = httplib.HTTPConnection(host(address), port(address) or 80) + + if url.lower().startswith('http://'): + http = httplib.HTTPConnection(host(address), port(address) or 80) + elif url.lower().startswith('https://'): + http = httplib.HTTPSConnection(host(address), port(address) or 443) + else: + assert False, url parts = url.split('/', 3) if len(parts) == 4: @@ -139,7 +143,7 @@ def get_ftp_size(url): def get_size(url): scheme = urlparse.urlparse(url)[0].lower() - if scheme.startswith('http'): + if scheme.startswith('http') or scheme.startswith('https'): return get_http_size(url) elif scheme.startswith('ftp'): return get_ftp_size(url) -- 2.11.4.GIT