Implemente automatic installation of missing dependencies when utilizing a SOCKS proxy // Resolve #4822

This commit is contained in:
Ivan Kravets committed 2024-01-06 17:48:18 +02:00
1 parent c74c9778a1
commit 41bd751ec2
3 files changed
+14 -5

No files matched your search

+2 -4
View File
@@ -13,7 +13,6 @@
# limitations under the License.
import json
import os
import socket
from urllib.parse import urljoin
@@ -23,6 +22,7 @@ from urllib3.util.retry import Retry
from platformio import __check_internet_hosts__, app, util
from platformio.cache import ContentCache, cleanup_content_cache
from platformio.exception import PlatformioException, UserSideException
from platformio.pipdeps import is_proxy_set
__default_requests_timeout__ = (10, None) # (connect, read)
@@ -191,9 +191,7 @@ def _internet_on():
socket.setdefaulttimeout(timeout)
for host in __check_internet_hosts__:
try:
for var in ("HTTP_PROXY", "HTTPS_PROXY"):
if not os.getenv(var) and not os.getenv(var.lower()):
continue
if is_proxy_set():
requests.get("http://%s" % host, allow_redirects=False, timeout=timeout)
return True
# try to resolve `host` for both AF_INET and AF_INET6, and then try to connect