Browse Source

on I/O error we always end without exception

master
Volker Birk 2 years ago
parent
commit
18f3e16abc
1 changed files with 3 additions and 10 deletions
  1. +3
    -10
      webserver.cc

+ 3
- 10
webserver.cc View File

@ -178,13 +178,8 @@ void Webserver::do_session(tcp::socket *socket)
{
http::request<http::string_body> req;
http::read(*socket, buffer, req, ec);
if (ec == http::error::end_of_stream || ec == net::error::connection_reset)
if (ec)
break;
if (ec) {
delete socket;
std::string err_msg(ec.message());
throw std::ios_base::failure(err_msg.c_str());
}
const auto method = req.method();
switch (method)
@ -219,10 +214,8 @@ void Webserver::do_session(tcp::socket *socket)
deliver_status(socket, req, http::status::method_not_allowed);
};
if (ec) {
delete socket;
throw std::ios_base::failure(ec.message());
}
if (ec)
break;
}
socket->shutdown(tcp::socket::shutdown_send, ec);


Loading…
Cancel
Save