Merge branch 'feature/ChangeSiteTesterFallbackHttp' into develop

This commit is contained in:
JackDandy 2018-09-13 04:09:31 +01:00
commit 3107049161
2 changed files with 14 additions and 1 deletions

View file

@ -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]

View file

@ -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)