Don't follow redirects when checking internet connection

This commit is contained in:
Ivan Kravets
2017-12-28 17:15:34 +02:00
parent 34e9063ddd
commit 12e4318de7
2 changed files with 3 additions and 2 deletions

View File

@ -669,7 +669,8 @@ def _internet_on():
for ip in PING_INTERNET_IPS:
try:
if os.getenv("HTTP_PROXY", os.getenv("HTTPS_PROXY")):
requests.get("http://%s" % ip, timeout=timeout)
requests.get(
"http://%s" % ip, allow_redirects=False, timeout=timeout)
else:
socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect((ip,
80))

View File

@ -19,4 +19,4 @@ from platformio import util
def test_ping_internet_ips():
for ip in util.PING_INTERNET_IPS:
requests.get("http://%s" % ip, timeout=2)
requests.get("http://%s" % ip, allow_redirects=False, timeout=2)