From 1f868c20bf7acd9af97f47f499e37b21c3c5d02d Mon Sep 17 00:00:00 2001
From: Andreas Nes Kile <andrenk@stud.ntnu.no>
Date: Wed, 11 Sep 2019 14:59:07 +0200
Subject: [PATCH] Added fix for error when GET reqeuest with large HTTP version
 is sent

---
 server_http.hpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/server_http.hpp b/server_http.hpp
index 219ea1e..04c4d90 100644
--- a/server_http.hpp
+++ b/server_http.hpp
@@ -739,9 +739,13 @@ 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