diff options
author | eidheim <eidheim@gmail.com> | 2020-04-17 14:38:29 +0300 |
---|---|---|
committer | eidheim <eidheim@gmail.com> | 2020-04-17 14:38:29 +0300 |
commit | f22dd889d3282473112ebbbf6992f5e857eeba3c (patch) | |
tree | 7c0adcc7b1e59670bfdda994097ed78d7c63ab76 | |
parent | 4bbf9c8d3c48efa5e3fb391c6c74974bc0913a30 (diff) |
Set default client port when unable to parse port string
-rw-r--r-- | client_ws.hpp | 7 |
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; } |