|
|
@ -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); |
|
|
|