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

ircd::resource: Make Access-Control-Allow-Origin response header a conf item.

This commit is contained in:
Jason Volk 2018-10-02 15:47:43 -07:00
parent fdb3f9bc4a
commit b9aa697206
2 changed files with 10 additions and 2 deletions

View file

@ -144,6 +144,7 @@ struct ircd::resource::response
struct chunked;
static const size_t HEAD_BUF_SZ;
static conf::item<std::string> access_control_allow_origin;
response(client &, const http::code &, const string_view &content_type, const size_t &content_length, const string_view &headers = {});
response(client &, const string_view &str, const string_view &content_type, const http::code &, const vector_view<const http::header> &);

View file

@ -990,6 +990,13 @@ ircd::resource::response::response(client &client,
assert(written == size(content));
}
decltype(ircd::resource::response::access_control_allow_origin)
ircd::resource::response::access_control_allow_origin
{
{ "name", "ircd.resource.access_control.allow_origin" },
{ "default", "*" }
};
ircd::resource::response::response(client &client,
const http::code &code,
const string_view &content_type,
@ -1018,8 +1025,8 @@ ircd::resource::response::response(client &client,
content_type,
headers,
{
{ "Access-Control-Allow-Origin", "*" }, //TODO: XXX
{ "X-IRCd-Request-Timer", rtime, },
{ "Access-Control-Allow-Origin", string_view(access_control_allow_origin) },
{ "X-IRCd-Request-Timer", rtime },
},
};