Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/Simple-WebSocket-Server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreidheim <eidheim@gmail.com>2020-04-17 14:38:29 +0300
committereidheim <eidheim@gmail.com>2020-04-17 14:38:29 +0300
commitf22dd889d3282473112ebbbf6992f5e857eeba3c (patch)
tree7c0adcc7b1e59670bfdda994097ed78d7c63ab76
parent4bbf9c8d3c48efa5e3fb391c6c74974bc0913a30 (diff)
Set default client port when unable to parse port string
-rw-r--r--client_ws.hpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/client_ws.hpp b/client_ws.hpp
index a892149..b17ff5e 100644
--- a/client_ws.hpp
+++ b/client_ws.hpp
@@ -367,7 +367,12 @@ namespace SimpleWeb {
}
else {
parsed_host_port.first = host_port.substr(0, host_end);
- parsed_host_port.second = static_cast<unsigned short>(stoul(host_port.substr(host_end + 1)));
+ try {
+ parsed_host_port.second = static_cast<unsigned short>(stoul(host_port.substr(host_end + 1)));
+ }
+ catch(...) {
+ parsed_host_port.second = default_port;
+ }
}
return parsed_host_port;
}