Skip to content
Snippets Groups Projects
Commit d60a57f4 authored by Mathias Oppedal Heggelund's avatar Mathias Oppedal Heggelund
Browse files

Fix unvalid HTTP-request error with try catch server_http.hpp

parent d44746f5
No related branches found
No related tags found
No related merge requests found
...@@ -762,12 +762,21 @@ namespace SimpleWeb { ...@@ -762,12 +762,21 @@ namespace SimpleWeb {
return; return;
} }
} }
try {
if(std::stof(response->session->request->http_version) >= 1.1) { if(std::stof(response->session->request->http_version) >= 1.1) {
auto new_session = std::make_shared<Session>(this->config.max_request_streambuf_size, response->session->connection); auto new_session = std::make_shared<Session>(this->config.max_request_streambuf_size, response->session->connection);
this->read(new_session); this->read(new_session);
return; return;
} }
} }
catch(std::invalid_argument &e) {
std::cout << "HTTP version not valid (string)";
}
catch(std::out_of_range &e) {
std::cout << "HTTP version not valid (out of range)";
}
}
else if(this->on_error) else if(this->on_error)
this->on_error(response->session->request, ec); this->on_error(response->session->request, ec);
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment