aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2019-01-09 18:26:22 -0800
committerGravatar Muxi Yan <mxyan@google.com>2019-01-09 18:26:22 -0800
commitc059946a75cab05a38dfb0c93afdbc0ee824d3a3 (patch)
treee5bcc7c17797f49fa72abcb64bc62cdbc4632705
parent302e7b4d2b97a2f4742296234b66507842bb096b (diff)
Fix bug where remote host's trailing slash is not removed, causing name resolution failure
-rw-r--r--src/objective-c/GRPCClient/private/GRPCChannelPool.m6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/objective-c/GRPCClient/private/GRPCChannelPool.m b/src/objective-c/GRPCClient/private/GRPCChannelPool.m
index a323f0490c..60a33eda82 100644
--- a/src/objective-c/GRPCClient/private/GRPCChannelPool.m
+++ b/src/objective-c/GRPCClient/private/GRPCChannelPool.m
@@ -236,6 +236,12 @@ static const NSTimeInterval kDefaultChannelDestroyDelay = 30;
return nil;
}
+ // remove trailing slash of hostname
+ NSURL *hostURL = [NSURL URLWithString:[@"https://" stringByAppendingString:host]];
+ if (hostURL.host && hostURL.port == nil) {
+ host = [hostURL.host stringByAppendingString:@":443"];
+ }
+
GRPCPooledChannel *pooledChannel = nil;
GRPCChannelConfiguration *configuration =
[[GRPCChannelConfiguration alloc] initWithHost:host callOptions:callOptions];