Skip to content
Snippets Groups Projects

Issue #21, HTTP version mismatch crashes server

Open Andreas Tolnes requested to merge andrtoln/buggy-web-server:master into master
1 file
+ 13
1
Compare changes
  • Side-by-side
  • Inline
+ 13
1
@@ -10,6 +10,7 @@
#include <list>
#include <map>
#include <sstream>
#include <stdexcept>
#include <thread>
#include <unordered_set>
@@ -762,7 +763,18 @@ namespace SimpleWeb {
return;
}
}
if(std::stof(response->session->request->http_version) >= 1.1) {
auto http_ver_string = response->session->request->http_version;
double http_ver_float;
try {
http_ver_float = std::stof(http_ver_string);
} catch (const std::invalid_argument) {
http_ver_float = 1.0;
}
if(http_ver_float >= 1.1) {
auto new_session = std::make_shared<Session>(this->config.max_request_streambuf_size, response->session->connection);
this->read(new_session);
return;
Loading