Skip to content

Commit 78afee4

Browse files
committed
Qualify stoi and only catch exceptions thrown by it.
1 parent d00836d commit 78afee4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

include/network/protocol/http/client/connection/async_normal.ipp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,11 +439,11 @@ struct http_async_connection_pimpl : boost::enable_shared_from_this<http_async_c
439439
auto it = headers_.find("Content-Length");
440440
if (it != headers_.end()) {
441441
try {
442-
unsigned content_length = stoi(it->second);
442+
unsigned content_length = std::stoi(it->second);
443443
get_more = (end - begin) < content_length;
444-
NETWORK_MESSAGE("Content-Length: " << content_length
445-
<< ", disconnect: " << !get_more);
446-
} catch(...) {
444+
NETWORK_MESSAGE("Content-Length: " << content_length);
445+
} catch(const std::invalid_argument&) {
446+
} catch(const std::out_of_range&) {
447447
}
448448
}
449449
// Here we don't have a body callback. Let's

0 commit comments

Comments
 (0)