Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion SocketRocket/Internal/Utilities/SRHTTPConnectMessage.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
{
NSString *host = url.host;
if (url.port) {
host = [host stringByAppendingFormat:@":%@", url.port];
if ([host containsString:@":"]) {
host = [NSString stringWithFormat:@"[%@]:%@", host, url.port];
} else {
host = [host stringByAppendingFormat:@":%@", url.port];
}
}
return host;
}
Expand Down
8 changes: 7 additions & 1 deletion SocketRocket/Internal/Utilities/SRURLUtilities.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@
} else if ([scheme isEqualToString:@"ws"]) {
scheme = @"http";
}
[origin appendFormat:@"%@://%@", scheme, url.host];

NSString * host = url.host;
if ([host containsString:@":"]) {
host = [NSString stringWithFormat:@"[%@]", host];
}

[origin appendFormat:@"%@://%@", scheme, host];

NSNumber *port = url.port;
BOOL portIsDefault = (!port ||
Expand Down