From 3757ea467989bbd2718ff767da76dd6a8f4f0bcd Mon Sep 17 00:00:00 2001
From: Aria <atdbui@stud.ntnu.no>
Date: Thu, 29 Aug 2019 01:56:55 +0200
Subject: [PATCH] add Try-Catch

---
 server_http.hpp | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/server_http.hpp b/server_http.hpp
index 219ea1e..5b63cd4 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(const std::exception &e) {
               return;
             }
           }
-- 
GitLab