mirror of
https://github.com/platformio/platformio-core.git
synced 2025-08-01 19:04:29 +02:00
Enhanced internet connection checks by falling back to HTTPS protocol when HTTP (port 80) fails // Resolve #4980
This commit is contained in:
@@ -22,6 +22,7 @@ test-driven methodologies, and modern toolchains for unrivaled success.
|
|||||||
~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
* Introduced the `PLATFORMIO_SYSTEM_TYPE <https://docs.platformio.org/en/latest/envvars.html#envvar-PLATFORMIO_SYSTEM_TYPE>`__ environment variable, enabling manual override of the detected system type for greater flexibility and control in custom build environments
|
* Introduced the `PLATFORMIO_SYSTEM_TYPE <https://docs.platformio.org/en/latest/envvars.html#envvar-PLATFORMIO_SYSTEM_TYPE>`__ environment variable, enabling manual override of the detected system type for greater flexibility and control in custom build environments
|
||||||
|
* Enhanced internet connection checks by falling back to HTTPS protocol when HTTP (port 80) fails (`issue #4980 <https://github.com/platformio/platformio-core/issues/4980>`_)
|
||||||
* Upgraded the build engine to the latest version of SCons (4.8.1) to improve build performance, reliability, and compatibility with other tools and systems (`release notes <https://github.com/SCons/scons/releases/tag/4.8.1>`__)
|
* Upgraded the build engine to the latest version of SCons (4.8.1) to improve build performance, reliability, and compatibility with other tools and systems (`release notes <https://github.com/SCons/scons/releases/tag/4.8.1>`__)
|
||||||
* Upgraded the `Doctest <https://docs.platformio.org/en/latest/advanced/unit-testing/frameworks/doctest.html>`__ testing framework to version 2.4.11, the `GoogleTest <https://docs.platformio.org/en/latest/advanced/unit-testing/frameworks/doctest.html>`__ to version 1.15.2, and the `Unity <https://docs.platformio.org/en/latest/advanced/unit-testing/frameworks/unity.html>`__ to version 2.6.0, incorporating the latest features and improvements for enhanced testing capabilities
|
* Upgraded the `Doctest <https://docs.platformio.org/en/latest/advanced/unit-testing/frameworks/doctest.html>`__ testing framework to version 2.4.11, the `GoogleTest <https://docs.platformio.org/en/latest/advanced/unit-testing/frameworks/doctest.html>`__ to version 1.15.2, and the `Unity <https://docs.platformio.org/en/latest/advanced/unit-testing/frameworks/unity.html>`__ to version 2.6.0, incorporating the latest features and improvements for enhanced testing capabilities
|
||||||
* Corrected an issue where the incorrect public class was imported for the ``DoctestTestRunner`` (`issue #4949 <https://github.com/platformio/platformio-core/issues/4949>`_)
|
* Corrected an issue where the incorrect public class was imported for the ``DoctestTestRunner`` (`issue #4949 <https://github.com/platformio/platformio-core/issues/4949>`_)
|
||||||
|
@@ -190,10 +190,11 @@ class HTTPClient:
|
|||||||
@util.memoized(expire="10s")
|
@util.memoized(expire="10s")
|
||||||
def _internet_on():
|
def _internet_on():
|
||||||
timeout = 2
|
timeout = 2
|
||||||
|
use_proxy = is_proxy_set()
|
||||||
socket.setdefaulttimeout(timeout)
|
socket.setdefaulttimeout(timeout)
|
||||||
for host in __check_internet_hosts__:
|
for host in __check_internet_hosts__:
|
||||||
try:
|
try:
|
||||||
if is_proxy_set():
|
if use_proxy:
|
||||||
requests.get("http://%s" % host, allow_redirects=False, timeout=timeout)
|
requests.get("http://%s" % host, allow_redirects=False, timeout=timeout)
|
||||||
return True
|
return True
|
||||||
# try to resolve `host` for both AF_INET and AF_INET6, and then try to connect
|
# try to resolve `host` for both AF_INET and AF_INET6, and then try to connect
|
||||||
@@ -203,6 +204,15 @@ def _internet_on():
|
|||||||
return True
|
return True
|
||||||
except: # pylint: disable=bare-except
|
except: # pylint: disable=bare-except
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# falling back to HTTPs, issue #4980
|
||||||
|
for host in __check_internet_hosts__:
|
||||||
|
try:
|
||||||
|
requests.get("https://%s" % host, allow_redirects=False, timeout=timeout)
|
||||||
|
except requests.exceptions.RequestException:
|
||||||
|
pass
|
||||||
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user