0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-15 22:41:12 +01:00

ircd::http: Support view of full URI in the request::head; use in X-Matrix auth.

This commit is contained in:
Jason Volk 2018-01-21 00:38:47 -08:00
parent 87effab106
commit 7867e7a0b4
3 changed files with 9 additions and 10 deletions

View file

@ -286,7 +286,8 @@ struct ircd::http::request::head
string_view user_agent;
size_t content_length {0};
string_view headers;
string_view uri; // full view of (path, query, fragmet)
string_view headers; // full view of all headers
head(parse::capstan &pc, const headers::closure &c = {});
head() = default;

View file

@ -296,6 +296,12 @@ ircd::http::request::request(stream_buffer &out,
ircd::http::request::head::head(parse::capstan &pc,
const headers::closure &c)
:line::request{pc}
,uri
{
fragment? string_view { begin(path), end(fragment) }:
query? string_view { begin(path), end(query) }:
string_view { begin(path), end(path) }
}
,headers
{
http::headers{pc, [this, &c](const auto &h)

View file

@ -175,14 +175,6 @@ ircd::verify_origin(client &client,
resource::request &request)
try
{
const fmt::bsprintf<1024> uri
{
"%s%s%s",
request.head.path,
request.query? "?" : "",
request.query
};
const m::request::x_matrix x_matrix
{
request.head.authorization
@ -190,7 +182,7 @@ try
const m::request object
{
x_matrix.origin, my_host(), method.name, uri, request.content
x_matrix.origin, my_host(), method.name, request.head.uri, request.content
};
const auto verified