From c059946a75cab05a38dfb0c93afdbc0ee824d3a3 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 9 Jan 2019 18:26:22 -0800 Subject: Fix bug where remote host's trailing slash is not removed, causing name resolution failure --- src/objective-c/GRPCClient/private/GRPCChannelPool.m | 6 ++++++ 1 file changed, 6 insertions(+) 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]; -- cgit v1.2.3