Skip to content

Commit

Permalink
Merge pull request grpc#21632 from ikedam/feature/no_proxy_for_empty_…
Browse files Browse the repository at this point in the history
…value

Treat an empty `http_proxy` mean "Don't use proxy" and skip parsing it
  • Loading branch information
yashykt authored Jan 17, 2020
2 parents 748ee20 + 22e21f9 commit 4466a4c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/ext/filters/client_channel/http_proxy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace {
*/
char* GetHttpProxyServer(char** user_cred) {
GPR_ASSERT(user_cred != nullptr);
grpc_uri* uri = nullptr;
char* proxy_name = nullptr;
char** authority_strs = nullptr;
size_t authority_nstrs;
Expand All @@ -58,7 +59,9 @@ char* GetHttpProxyServer(char** user_cred) {
if (uri_str == nullptr) uri_str = gpr_getenv("https_proxy");
if (uri_str == nullptr) uri_str = gpr_getenv("http_proxy");
if (uri_str == nullptr) return nullptr;
grpc_uri* uri = grpc_uri_parse(uri_str, false /* suppress_errors */);
// an emtpy value means "don't use proxy"
if (uri_str[0] == '\0') goto done;
uri = grpc_uri_parse(uri_str, false /* suppress_errors */);
if (uri == nullptr || uri->authority == nullptr) {
gpr_log(GPR_ERROR, "cannot parse value of 'http_proxy' env var");
goto done;
Expand Down

0 comments on commit 4466a4c

Please sign in to comment.