From 848dfe66f525429494f15177e6d218cf21f5a5c2 Mon Sep 17 00:00:00 2001 From: Sergey Talash Date: Tue, 12 Sep 2023 14:37:54 +0600 Subject: [PATCH] Update http_support.py with NO_PROXY support --- rsconnect/http_support.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rsconnect/http_support.py b/rsconnect/http_support.py index 261b2e52..0661f4b2 100644 --- a/rsconnect/http_support.py +++ b/rsconnect/http_support.py @@ -75,7 +75,10 @@ def _create_ssl_connection(host_name, port, disable_tls_check, ca_data): """ if ca_data is not None and disable_tls_check: raise ValueError("Cannot both disable TLS checking and provide a custom certificate") - _, _, proxyHost, proxyPort = _get_proxy() + if any([host_name.endswith(host) for host in os.environ.get('NO_PROXY', '#').split(',')]): + proxyHost, proxyPort = None, None + else: + _, _, proxyHost, proxyPort = _get_proxy() headers = _get_proxy_headers() timeout = get_request_timeout() logger.debug(f"The HTTPSConnection timeout is set to '{timeout}' seconds")