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:
parent
36142718f6
commit
09d0c9b2d6
1 changed files with 17 additions and 2 deletions
|
@ -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} }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue