From 3c8d98ecd044ae36f656f19b86ccc652e869048b Mon Sep 17 00:00:00 2001 From: Pasquale Boemio Date: Sat, 27 Apr 2013 19:42:24 +0200 Subject: [PATCH 1/2] added last case --- easywsclient.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/easywsclient.cpp b/easywsclient.cpp index b3b7591..b34bb3f 100644 --- a/easywsclient.cpp +++ b/easywsclient.cpp @@ -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, &port) == 1) { + port = 80; + } else { fprintf(stderr, "ERROR: Could not parse WebSocket url: %s\n", url.c_str()); return NULL; From db9c58f58ef4e006d5e189824c2bbf1bde0bc5f1 Mon Sep 17 00:00:00 2001 From: Pasquale Boemio Date: Sat, 27 Apr 2013 19:48:26 +0200 Subject: [PATCH 2/2] typo --- easywsclient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easywsclient.cpp b/easywsclient.cpp index b34bb3f..f9e010e 100644 --- a/easywsclient.cpp +++ b/easywsclient.cpp @@ -267,7 +267,7 @@ 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, &port) == 1) { + else if (sscanf(url.c_str(), "ws://%[^:]", host) == 1) { port = 80; } else {