Merge pull request #15698 from yashykt/httpsproxy

Prefer using https_proxy for secure channels and http_proxy for insec…
reviewable/pr15630/r6^2
Yash Tibrewal 7 years ago committed by GitHub
commit a726484455
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      src/core/ext/filters/client_channel/http_proxy.cc

@ -37,17 +37,21 @@
#include "src/core/lib/slice/b64.h"
/**
* Parses the 'http_proxy' env var and returns the proxy hostname to resolve or
* nullptr on error. Also sets 'user_cred' to user credentials if present in the
* 'http_proxy' env var, otherwise leaves it unchanged. It is caller's
* responsibility to gpr_free user_cred.
* Parses the 'https_proxy' env var (fallback on 'http_proxy') and returns the
* proxy hostname to resolve or nullptr on error. Also sets 'user_cred' to user
* credentials if present in the 'http_proxy' env var, otherwise leaves it
* unchanged. It is caller's responsibility to gpr_free user_cred.
*/
static char* get_http_proxy_server(char** user_cred) {
GPR_ASSERT(user_cred != nullptr);
char* proxy_name = nullptr;
char* uri_str = gpr_getenv("http_proxy");
char** authority_strs = nullptr;
size_t authority_nstrs;
/* Prefer using 'https_proxy'. Fallback on 'http_proxy' if it is not set. The
* fallback behavior can be removed if there's a demand for it.
*/
char* 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 */);
if (uri == nullptr || uri->authority == nullptr) {

Loading…
Cancel
Save