Merge pull request #2 from helloIAmPau/master

Allow for no :port and no / in URLs
This commit is contained in:
David Baird
2013-04-27 22:14:01 -07:00
+3
View File
@@ -267,6 +267,9 @@ WebSocket::pointer WebSocket::from_url(std::string url) {
}
else if (sscanf(url.c_str(), "ws://%[^:]:%d", host, &port) == 2) {
}
else if (sscanf(url.c_str(), "ws://%[^:]", host) == 1) {
port = 80;
}
else {
fprintf(stderr, "ERROR: Could not parse WebSocket url: %s\n", url.c_str());
return NULL;