Client: added try catch when parsing length of chunked content
This commit is contained in:
parent
64bd58e5da
commit
42de0bea13
1 changed files with 8 additions and 1 deletions
|
|
@ -534,7 +534,14 @@ namespace SimpleWeb {
|
|||
getline(session->response->content, line);
|
||||
bytes_transferred -= line.size() + 1;
|
||||
line.pop_back();
|
||||
auto length = stoul(line, 0, 16);
|
||||
unsigned long length;
|
||||
try {
|
||||
length = stoul(line, 0, 16);
|
||||
}
|
||||
catch(...) {
|
||||
session->callback(session->connection, make_error_code::make_error_code(errc::protocol_error));
|
||||
return;
|
||||
}
|
||||
|
||||
auto num_additional_bytes = session->response->content_buffer.size() - bytes_transferred;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue