Skip to content
Snippets Groups Projects
Commit 33425245 authored by Johan-Henrik Fylling's avatar Johan-Henrik Fylling
Browse files

#33 Stopped converting http_version to float. Using string comparision...

#33 Stopped converting http_version to float. Using string comparision instead. No more exceptions caused by incorrect version number. Also added try/catch to io_service-run(); which would catch such exceptions if they occur.
parent c0bfd99e
Branches master
No related tags found
No related merge requests found
Pipeline #46733 failed
...@@ -435,8 +435,15 @@ namespace SimpleWeb { ...@@ -435,8 +435,15 @@ namespace SimpleWeb {
} }
// Main thread // Main thread
while(true){
try{
if(config.thread_pool_size > 0) if(config.thread_pool_size > 0)
io_service->run(); io_service->run();
}
catch(...) {
std::cout << "Caught exception in main thread\n";
}
}
// Wait for the rest of the threads, if any, to finish as well // Wait for the rest of the threads, if any, to finish as well
for(auto &t : threads) for(auto &t : threads)
...@@ -739,7 +746,7 @@ namespace SimpleWeb { ...@@ -739,7 +746,7 @@ namespace SimpleWeb {
return; return;
} }
} }
if(std::stof(response->session->request->http_version) >= 1.1) { if(!case_insensitive_equal(response->session->request->http_version, "1.1")) {
auto new_session = std::make_shared<Session>(this->config.max_request_streambuf_size, response->session->connection); auto new_session = std::make_shared<Session>(this->config.max_request_streambuf_size, response->session->connection);
this->read(new_session); this->read(new_session);
return; return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment