0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-11 06:28:55 +02: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<"uri"_>(*this) = uri;
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)