Skip to content

Commit

Permalink
Fix bug where remote host's trailing slash is not removed, causing na…
Browse files Browse the repository at this point in the history
…me resolution failure
  • Loading branch information
Muxi Yan committed Jan 10, 2019
1 parent 302e7b4 commit c059946
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/objective-c/GRPCClient/private/GRPCChannelPool.m
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,12 @@ - (GRPCPooledChannel *)channelWithHost:(NSString *)host callOptions:(GRPCCallOpt
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];
Expand Down

0 comments on commit c059946

Please sign in to comment.