Fixes #295: set default client port when unable to parse port string
This commit is contained in:
parent
ebeafc989e
commit
61990c2aee
1 changed files with 6 additions and 1 deletions
|
|
@ -507,7 +507,12 @@ namespace SimpleWeb {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
parsed_host_port.first = host_port.substr(0, host_end);
|
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;
|
return parsed_host_port;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue