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:
parent
d38d4b22f6
commit
6b0187ea62
1 changed files with 16 additions and 0 deletions
16
ircd/m.cc
16
ircd/m.cc
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue