From 9b0cc4c6c06993675a4e808ee2c8362cca50f286 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Wed, 1 Feb 2017 08:09:08 -0800 Subject: [PATCH] Fix client channel code to parse server URI from channel arg. --- src/core/ext/client_channel/client_channel.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/ext/client_channel/client_channel.c b/src/core/ext/client_channel/client_channel.c index 07eb68a3eb1..254e5ea5da0 100644 --- a/src/core/ext/client_channel/client_channel.c +++ b/src/core/ext/client_channel/client_channel.c @@ -546,7 +546,11 @@ static grpc_error *cc_init_channel_elem(grpc_exec_ctx *exec_ctx, arg = grpc_channel_args_find(args->channel_args, GRPC_ARG_SERVER_URI); GPR_ASSERT(arg != NULL); GPR_ASSERT(arg->type == GRPC_ARG_STRING); - chand->server_name = gpr_strdup(arg->value.string); + grpc_uri *uri = grpc_uri_parse(arg->value.string, true); + GPR_ASSERT(uri->path[0] != '\0'); + chand->server_name = + gpr_strdup(uri->path[0] == '/' ? uri->path + 1 : uri->path); + grpc_uri_destroy(uri); chand->proxy_name = grpc_get_http_proxy_server(); char *name_to_resolve = chand->proxy_name == NULL ? chand->server_name : chand->proxy_name;