aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar David G. Quintas <dgq@google.com>2016-12-16 16:27:11 -0800
committerGravatar GitHub <noreply@github.com>2016-12-16 16:27:11 -0800
commit4f4b278b8852382aa1761f03f2a05aa4bd419966 (patch)
treef837c56744875e142e4147df21429d3d72731881 /src
parente1fdd860fc6a9873a215839739ef5db39f5df718 (diff)
parent855a1063ecfe777935f5d92a25a610856179a630 (diff)
Merge pull request #9144 from dgquintas/grpclb_server_uri
grpclb: skip slash in server uri path if present
Diffstat (limited to 'src')
-rw-r--r--src/core/ext/lb_policy/grpclb/grpclb.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/core/ext/lb_policy/grpclb/grpclb.c b/src/core/ext/lb_policy/grpclb/grpclb.c
index 38eebdc758..bed5e6c901 100644
--- a/src/core/ext/lb_policy/grpclb/grpclb.c
+++ b/src/core/ext/lb_policy/grpclb/grpclb.c
@@ -768,8 +768,14 @@ static grpc_lb_policy *glb_create(grpc_exec_ctx *exec_ctx,
arg = grpc_channel_args_find(args->args, GRPC_ARG_SERVER_URI);
GPR_ASSERT(arg != NULL);
GPR_ASSERT(arg->type == GRPC_ARG_STRING);
- grpc_uri *uri = grpc_uri_parse(arg->value.string, 1);
- glb_policy->server_name = gpr_strdup(uri->path);
+ grpc_uri *uri = grpc_uri_parse(arg->value.string, true);
+ GPR_ASSERT(uri->path[0] != '\0');
+ glb_policy->server_name =
+ gpr_strdup(uri->path[0] == '/' ? uri->path + 1 : uri->path);
+ if (grpc_lb_glb_trace) {
+ gpr_log(GPR_INFO, "Will use '%s' as the server name for LB request.",
+ glb_policy->server_name);
+ }
grpc_uri_destroy(uri);
/* All input addresses in addresses come from a resolver that claims