Skip to content

Commit

Permalink
Clarify intention of the code that adds a default port
Browse files Browse the repository at this point in the history
  • Loading branch information
jcanizales committed Aug 6, 2015
1 parent 55fcf50 commit 015ab35
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/objective-c/GRPCClient/private/GRPCHost.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ - (instancetype)init {
// Default initializer.
- (instancetype)initWithAddress:(NSString *)address {

// To provide a default port, we try to interpret the address.
// TODO(jcanizales): Add unit tests for the types of addresses we want to let pass through.
// To provide a default port, we try to interpret the address. If it's just a host name without
// 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]];
if (hostURL && !hostURL.port) {
address = [hostURL.host stringByAppendingString:@":443"];
Expand Down

0 comments on commit 015ab35

Please sign in to comment.