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

ircd: Respond with Allow header when 405'ing.

This commit is contained in:
Jason Volk 2017-12-24 14:35:36 -07:00
parent 36142718f6
commit 09d0c9b2d6

View file

@ -366,10 +366,25 @@ try
}
catch(const std::out_of_range &e)
{
//TODO: This will have to respond with an Accept header listing methods.
size_t len(0);
char buf[128]; buf[0] = '\0';
auto it(begin(methods));
if(it != end(methods))
{
len = strlcat(buf, it->first);
for(++it; it != end(methods); ++it)
{
len = strlcat(buf, " ");
len = strlcat(buf, it->first);
}
}
throw http::error
{
http::METHOD_NOT_ALLOWED
http::METHOD_NOT_ALLOWED, {},
{
{ "Allow", string_view{buf, len} }
}
};
}