Skip to content
Snippets Groups Projects
Commit eddb0065 authored by Jorge Canizales's avatar Jorge Canizales
Browse files

Fixes host transformation when user supplies a port.

parent f1bda85a
No related branches found
No related tags found
No related merge requests found
...@@ -59,11 +59,11 @@ ...@@ -59,11 +59,11 @@
[NSException raise:NSInvalidArgumentException format:@"Invalid URL: %@", host]; [NSException raise:NSInvalidArgumentException format:@"Invalid URL: %@", host];
} }
if ([hostURL.scheme isEqualToString:@"https"]) { if ([hostURL.scheme isEqualToString:@"https"]) {
host = [hostURL.host stringByAppendingString:hostURL.port.stringValue ?: @":443"]; host = [@[hostURL.host, hostURL.port ?: @443] componentsJoinedByString:@":"];
return [[GRPCSecureChannel alloc] initWithHost:host]; return [[GRPCSecureChannel alloc] initWithHost:host];
} }
if ([hostURL.scheme isEqualToString:@"http"]) { if ([hostURL.scheme isEqualToString:@"http"]) {
host = [hostURL.host stringByAppendingString:hostURL.port.stringValue ?: @":80"]; host = [@[hostURL.host, hostURL.port ?: @80] componentsJoinedByString:@":"];
return [[GRPCUnsecuredChannel alloc] initWithHost:host]; return [[GRPCUnsecuredChannel alloc] initWithHost:host];
} }
[NSException raise:NSInvalidArgumentException [NSException raise:NSInvalidArgumentException
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment