|
|
@ -58,8 +58,10 @@ |
|
|
|
// Default initializer. |
|
|
|
// Default initializer. |
|
|
|
- (instancetype)initWithAddress:(NSString *)address { |
|
|
|
- (instancetype)initWithAddress:(NSString *)address { |
|
|
|
|
|
|
|
|
|
|
|
// To provide a default port, we try to interpret the address. |
|
|
|
// To provide a default port, we try to interpret the address. If it's just a host name without |
|
|
|
// TODO(jcanizales): Add unit tests for the types of addresses we want to let pass through. |
|
|
|
// scheme and without port, we'll use port 443. If it has a scheme, we pass it untouched to the C |
|
|
|
|
|
|
|
// gRPC library. |
|
|
|
|
|
|
|
// TODO(jcanizales): Add unit tests for the types of addresses we want to let pass untouched. |
|
|
|
NSURL *hostURL = [NSURL URLWithString:[@"https://" stringByAppendingString:address]]; |
|
|
|
NSURL *hostURL = [NSURL URLWithString:[@"https://" stringByAppendingString:address]]; |
|
|
|
if (hostURL && !hostURL.port) { |
|
|
|
if (hostURL && !hostURL.port) { |
|
|
|
address = [hostURL.host stringByAppendingString:@":443"]; |
|
|
|
address = [hostURL.host stringByAppendingString:@":443"]; |
|
|
|