diff --git a/server_http.hpp b/server_http.hpp index c6402f50c2ac1a52ac4c961da81e361711ebfbc4..f3c0d53605ca57995f7219f2b8182aeffed99bcf 100644 --- a/server_http.hpp +++ b/server_http.hpp @@ -762,10 +762,16 @@ namespace SimpleWeb { return; } } - 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); - this->read(new_session); - return; + try { + 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); + this->read(new_session); + return; + } + } catch (const std::invalid_argument& ia){ + std::cout << "Invalid argument in HTTP version number " << ia.what() << std::endl; + } catch (const std::out_of_range& oor){ + std::cout << "Out of range in HTTP version number " << oor.what() << std::endl; } } else if(this->on_error)