mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
modules/media: Add explicit cache controls w/ immutability hint.
This commit is contained in:
parent
2a5c234d76
commit
8003c07762
2 changed files with 17 additions and 3 deletions
|
@ -127,10 +127,19 @@ get__download_local(client &client,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
static const auto &addl_headers
|
||||||
|
{
|
||||||
|
"Cache-Control: public, max-age=31536000, immutable\r\n"_sv
|
||||||
|
};
|
||||||
|
|
||||||
// Send HTTP head to client
|
// Send HTTP head to client
|
||||||
m::resource::response
|
m::resource::response
|
||||||
{
|
{
|
||||||
client, http::OK, content_type, file_size
|
client,
|
||||||
|
http::OK,
|
||||||
|
content_type,
|
||||||
|
file_size,
|
||||||
|
addl_headers,
|
||||||
};
|
};
|
||||||
|
|
||||||
size_t sent{0}, read
|
size_t sent{0}, read
|
||||||
|
|
|
@ -327,10 +327,15 @@ get__thumbnail_local(client &client,
|
||||||
"Unknown reason",
|
"Unknown reason",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const auto &addl_headers
|
||||||
|
{
|
||||||
|
"Cache-Control: public, max-age=31536000, immutable\r\n"_sv
|
||||||
|
};
|
||||||
|
|
||||||
if(fallback)
|
if(fallback)
|
||||||
return m::resource::response
|
return m::resource::response
|
||||||
{
|
{
|
||||||
client, buf, content_type
|
client, buf, content_type, http::OK, addl_headers
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto closure{[&client, &content_type]
|
const auto closure{[&client, &content_type]
|
||||||
|
@ -338,7 +343,7 @@ get__thumbnail_local(client &client,
|
||||||
{
|
{
|
||||||
m::resource::response
|
m::resource::response
|
||||||
{
|
{
|
||||||
client, buf, content_type
|
client, buf, content_type, http::OK, addl_headers
|
||||||
};
|
};
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue