From 8c69a48975ec02e67658661380c3890ac5ffe38e Mon Sep 17 00:00:00 2001 From: JackDandy Date: Thu, 13 Sep 2018 04:05:39 +0100 Subject: [PATCH] Change site services tester to fallback to http if error with SSL. --- CHANGES.md | 1 + sickbeard/webserve.py | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 9aefab6e..08fab68e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -13,6 +13,7 @@ * Change if old scandir binary module is installed, fallback to slow Python module and inform user to upgrade binary * Update SimpleJSON 3.13.2 (6ffddbe) to 3.16.0 (e2a54f7) * Update unidecode module 1.0.22 (81f938d) to 1.0.22 (578cdb9) +* Change site services tester to fallback to http if error with SSL [develop changelog] diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index 901095d6..5b1e72a5 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -5347,7 +5347,19 @@ class History(MainHandler): result = {} if site_url: - resp = helpers.getURL('https://www.isitdownrightnow.com/check.php?domain=%s' % site_url) + import requests + down_url = 'www.isitdownrightnow.com' + proto = 'https' + try: + requests.head('%s://%s' % (proto, down_url), timeout=5) + except (StandardError, Exception): + proto = 'http' + try: + requests.head('%s://%s' % (proto, down_url), timeout=5) + except (StandardError, Exception): + return json.dumps(result) + + resp = helpers.getURL('%s://%s/check.php?domain=%s' % (proto, down_url, site_url)) if resp: check = resp.lower() day = re.findall(r'(\d+)\s*(?:day)', check)