diff options
author | 2018-06-12 13:58:33 -0700 | |
---|---|---|
committer | 2018-06-12 13:58:33 -0700 | |
commit | 56e59ef6b03c73ecddf0954ee409a3f60ed5ea30 (patch) | |
tree | e8251ce65c00be12b26ed156b4d03360d3945e2f /src/core | |
parent | 87a63e0e8ad0f78f50a9ab2966b422a98fbb52ad (diff) | |
parent | 21dbaab4be595bc2f34890e92f3656a61694e522 (diff) |
Merge pull request #15699 from yashykt/noproxyarg
Add channel arg to enable/disable http proxy
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/ext/filters/client_channel/http_proxy.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/ext/filters/client_channel/http_proxy.cc b/src/core/ext/filters/client_channel/http_proxy.cc index 29a6c0e367..9baccd8628 100644 --- a/src/core/ext/filters/client_channel/http_proxy.cc +++ b/src/core/ext/filters/client_channel/http_proxy.cc @@ -83,11 +83,24 @@ done: return proxy_name; } +/** + * Checks the value of GRPC_ARG_ENABLE_HTTP_PROXY to determine if http_proxy + * should be used. + */ +bool http_proxy_enabled(const grpc_channel_args* args) { + const grpc_arg* arg = + grpc_channel_args_find(args, GRPC_ARG_ENABLE_HTTP_PROXY); + return grpc_channel_arg_get_bool(arg, true); +} + static bool proxy_mapper_map_name(grpc_proxy_mapper* mapper, const char* server_uri, const grpc_channel_args* args, char** name_to_resolve, grpc_channel_args** new_args) { + if (!http_proxy_enabled(args)) { + return false; + } char* user_cred = nullptr; *name_to_resolve = get_http_proxy_server(&user_cred); if (*name_to_resolve == nullptr) return false; |