0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-16 15:00:51 +01:00

ircd:Ⓜ️:request: Add validations for origin/destination strings here.

This commit is contained in:
Jason Volk 2019-05-06 11:08:33 -07:00
parent d38d4b22f6
commit 6b0187ea62

View file

@ -4549,6 +4549,22 @@ ircd::m::request::request(const string_view &origin,
json::get<"method"_>(*this) = method; json::get<"method"_>(*this) = method;
json::get<"uri"_>(*this) = uri; json::get<"uri"_>(*this) = uri;
json::get<"content"_>(*this) = content; json::get<"content"_>(*this) = content;
if(unlikely(origin && !rfc3986::valid_remote(std::nothrow, origin)))
throw m::error
{
http::BAD_REQUEST, "M_REQUEST_INVALID_ORIGIN",
"This origin string '%s' is not a valid remote.",
origin
};
if(unlikely(destination && !rfc3986::valid_remote(std::nothrow, destination)))
throw m::error
{
http::BAD_REQUEST, "M_REQUEST_INVALID_DESTINATION",
"This destination string '%s' is not a valid remote.",
destination
};
} }
decltype(ircd::m::request::headers_max) decltype(ircd::m::request::headers_max)