0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-28 16:34:13 +01:00

ircd: Move client request exception handler to where the rest are.

This commit is contained in:
Jason Volk 2017-11-25 14:20:46 -07:00
parent 1b1e9ace7a
commit 62caa95ec8

View file

@ -263,6 +263,25 @@ noexcept try
return true;
}
catch(const http::error &e)
{
log::debug("client[%s] HTTP %s in %ld$us %s",
string(remote(*this)),
e.what(),
request_timer.at<microseconds>().count(),
e.content);
switch(e.code)
{
case http::BAD_REQUEST:
case http::REQUEST_TIMEOUT:
case http::INTERNAL_SERVER_ERROR:
return false;
default:
return true;
}
}
catch(const boost::system::system_error &e)
{
using namespace boost::system::errc;
@ -298,6 +317,7 @@ catch(const boost::system::system_error &e)
else if(ec.category() == get_ssl_category()) switch(uint8_t(value))
{
case SSL_R_SHORT_READ:
case SSL_R_PROTOCOL_IS_SHUTDOWN:
disconnect(*this, net::dc::RST);
return false;
@ -339,7 +359,6 @@ catch(const std::exception &e)
bool
ircd::handle_request(client &client,
parse::capstan &pc)
try
{
client.request_timer = ircd::timer{};
const socket::scope_timeout timeout
@ -365,25 +384,6 @@ try
return ret;
}
catch(const http::error &e)
{
log::debug("client[%s] HTTP %s in %ld$us %s",
string(remote(client)),
e.what(),
client.request_timer.at<microseconds>().count(),
e.content);
switch(e.code)
{
case http::BAD_REQUEST:
case http::REQUEST_TIMEOUT:
case http::INTERNAL_SERVER_ERROR:
return false;
default:
return true;
}
}
void
ircd::handle_request(client &client,