2019-02-18 19:40:21 +01:00
|
|
|
// Matrix Construct
|
|
|
|
//
|
|
|
|
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
|
|
|
// Copyright (C) 2016-2019 Jason Volk <jason@zemos.net>
|
|
|
|
//
|
|
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice is present in all copies. The
|
|
|
|
// full license for this software is available in the LICENSE file.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#define HAVE_IRCD_RESOURCE_REQUEST_H
|
|
|
|
|
|
|
|
struct ircd::resource::request
|
|
|
|
:json::object
|
|
|
|
{
|
|
|
|
template<class> struct object;
|
|
|
|
|
|
|
|
http::request::head head;
|
|
|
|
string_view content;
|
|
|
|
http::query::string query;
|
2022-07-14 23:24:53 +02:00
|
|
|
pair<string_view> agent;
|
2020-10-13 02:05:05 +02:00
|
|
|
string_view params;
|
2019-02-18 19:40:21 +01:00
|
|
|
vector_view<string_view> parv;
|
|
|
|
string_view param[8];
|
|
|
|
|
2022-07-14 23:24:53 +02:00
|
|
|
private:
|
|
|
|
static pair<string_view> parse_agent(const http::request::head &) noexcept;
|
|
|
|
|
|
|
|
public:
|
2022-07-14 23:18:02 +02:00
|
|
|
request(const http::request::head &, const string_view &content) noexcept;
|
2019-02-18 19:40:21 +01:00
|
|
|
request() = default;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<class tuple>
|
|
|
|
struct ircd::resource::request::object
|
|
|
|
:tuple
|
|
|
|
{
|
|
|
|
resource::request &r;
|
|
|
|
const http::request::head &head;
|
|
|
|
const string_view &content;
|
|
|
|
const http::query::string &query;
|
2022-07-14 23:24:53 +02:00
|
|
|
const pair<string_view> &agent;
|
2020-10-13 02:05:05 +02:00
|
|
|
const string_view ¶ms;
|
2019-02-18 19:40:21 +01:00
|
|
|
const vector_view<string_view> &parv;
|
|
|
|
const json::object &body;
|
|
|
|
|
2022-07-14 23:18:02 +02:00
|
|
|
object(resource::request &) noexcept;
|
2019-02-18 19:40:21 +01:00
|
|
|
};
|
2022-07-14 23:18:02 +02:00
|
|
|
|
|
|
|
template<class tuple>
|
|
|
|
inline
|
|
|
|
ircd::resource::request::object<tuple>::object(resource::request &r)
|
|
|
|
noexcept
|
|
|
|
:tuple{r}
|
|
|
|
,r{r}
|
|
|
|
,head{r.head}
|
|
|
|
,content{r.content}
|
|
|
|
,query{r.query}
|
2022-07-14 23:24:53 +02:00
|
|
|
,agent{r.agent}
|
2022-07-14 23:18:02 +02:00
|
|
|
,params{r.params}
|
|
|
|
,parv{r.parv}
|
|
|
|
,body{r}
|
|
|
|
{}
|