From c75fa52538499943ef6e08d076d594b3501cd119 Mon Sep 17 00:00:00 2001 From: Patrick Thorkildsen <patrickt@stud.ntnu.no> Date: Wed, 28 Aug 2019 14:15:25 +0200 Subject: [PATCH] Added try-catch to handle http version exception --- server_http.hpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/server_http.hpp b/server_http.hpp index 219ea1e..96a0bc4 100644 --- a/server_http.hpp +++ b/server_http.hpp @@ -739,9 +739,14 @@ 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); + 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(std::exception) { return; } } -- GitLab