mirror of
https://github.com/matrix-construct/construct
synced 2024-11-04 21:08:57 +01:00
ircd::http: Verify HTTP version after request line.
This commit is contained in:
parent
197168059b
commit
bba6981166
1 changed files with 10 additions and 4 deletions
14
ircd/http.cc
14
ircd/http.cc
|
@ -282,9 +282,15 @@ ircd::http::request::head::head(parse::capstan &pc,
|
|||
query? string_view { begin(path), end(query) }:
|
||||
string_view { begin(path), end(path) }
|
||||
}
|
||||
,headers
|
||||
,headers{[this, &pc, &c]
|
||||
{
|
||||
http::headers{pc, [this, &c](const auto &h)
|
||||
if(!this->version || this->version != "HTTP/1.1")
|
||||
throw error
|
||||
{
|
||||
HTTP_VERSION_NOT_SUPPORTED, "Sorry, only HTTP/1.1 supported here."
|
||||
};
|
||||
|
||||
return http::headers{pc, [this, &c](const auto &h)
|
||||
{
|
||||
if(iequals(h.first, "host"_sv))
|
||||
this->host = h.second;
|
||||
|
@ -305,8 +311,8 @@ ircd::http::request::head::head(parse::capstan &pc,
|
|||
|
||||
if(c)
|
||||
c(h);
|
||||
}}
|
||||
}
|
||||
}};
|
||||
}()}
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue