aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2017-02-01 08:09:08 -0800
committerGravatar Mark D. Roth <roth@google.com>2017-02-01 08:09:08 -0800
commit9b0cc4c6c06993675a4e808ee2c8362cca50f286 (patch)
treef5195a05969f8829a93007e88b8c395b35955414 /src
parente453404d318982f64b244db8fa487b3deef3887d (diff)
Fix client channel code to parse server URI from channel arg.
Diffstat (limited to 'src')
-rw-r--r--src/core/ext/client_channel/client_channel.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/ext/client_channel/client_channel.c b/src/core/ext/client_channel/client_channel.c
index 07eb68a3eb..254e5ea5da 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;