0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-01 19:22:53 +01:00

ircd: Propagate better error back to user here for now.

This commit is contained in:
Jason Volk 2018-01-17 22:04:05 -08:00
parent 9f6eda4c3d
commit a9dabd661b

View file

@ -173,6 +173,7 @@ void
ircd::verify_origin(client &client, ircd::verify_origin(client &client,
resource::method &method, resource::method &method,
resource::request &request) resource::request &request)
try
{ {
const auto &authorization const auto &authorization
{ {
@ -189,11 +190,27 @@ ircd::verify_origin(client &client,
m::verify_x_matrix_authorization(authorization, method.name, uri, request.content) m::verify_x_matrix_authorization(authorization, method.name, uri, request.content)
}; };
if(!verified) if(verified)
throw m::error return;
{
http::UNAUTHORIZED, "M_INVALID_SIGNATURE", "The X-Matrix Authorization is invalid." throw m::error
}; {
http::UNAUTHORIZED, "M_INVALID_SIGNATURE",
"The X-Matrix Authorization is invalid."
};
}
catch(const m::error &)
{
throw;
}
catch(const std::exception &e)
{
throw m::error
{
http::UNAUTHORIZED, "M_INTERNAL_ERROR",
"An error has prevented authorization: %s",
e.what()
};
} }
void void