Merge pull request #17116 from zsojma/feature/no_grpc_proxy

ability to set grpc proxy with no effect on http proxy
pull/19462/head
Yash Tibrewal 5 years ago committed by GitHub
commit 7a0f7ec1e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/core/ext/filters/client_channel/http_proxy.cc

@ -47,10 +47,12 @@ static char* get_http_proxy_server(char** user_cred) {
char* proxy_name = nullptr; char* proxy_name = nullptr;
char** authority_strs = nullptr; char** authority_strs = nullptr;
size_t authority_nstrs; size_t authority_nstrs;
/* Prefer using 'https_proxy'. Fallback on 'http_proxy' if it is not set. The /* Prefer using 'grpc_proxy'. Fallback on 'http_proxy' if it is not set.
* Also prefer using 'https_proxy' with fallback on 'http_proxy'. The
* fallback behavior can be removed if there's a demand for it. * fallback behavior can be removed if there's a demand for it.
*/ */
char* uri_str = gpr_getenv("https_proxy"); char* uri_str = gpr_getenv("grpc_proxy");
if (uri_str == nullptr) uri_str = gpr_getenv("https_proxy");
if (uri_str == nullptr) uri_str = gpr_getenv("http_proxy"); if (uri_str == nullptr) uri_str = gpr_getenv("http_proxy");
if (uri_str == nullptr) return nullptr; if (uri_str == nullptr) return nullptr;
grpc_uri* uri = grpc_uri_parse(uri_str, false /* suppress_errors */); grpc_uri* uri = grpc_uri_parse(uri_str, false /* suppress_errors */);
@ -122,7 +124,9 @@ static bool proxy_mapper_map_name(grpc_proxy_mapper* mapper,
server_uri); server_uri);
goto no_use_proxy; goto no_use_proxy;
} }
no_proxy_str = gpr_getenv("no_proxy"); /* Prefer using 'no_grpc_proxy'. Fallback on 'no_proxy' if it is not set. */
no_proxy_str = gpr_getenv("no_grpc_proxy");
if (no_proxy_str == nullptr) no_proxy_str = gpr_getenv("no_proxy");
if (no_proxy_str != nullptr) { if (no_proxy_str != nullptr) {
static const char* NO_PROXY_SEPARATOR = ","; static const char* NO_PROXY_SEPARATOR = ",";
bool use_proxy = true; bool use_proxy = true;

Loading…
Cancel
Save