0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-25 23:14:13 +01:00

modules/media: Add explicit cache controls w/ immutability hint.

This commit is contained in:
Jason Volk 2020-06-12 18:06:55 -07:00
parent 2a5c234d76
commit 8003c07762
2 changed files with 17 additions and 3 deletions

View file

@ -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

View file

@ -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
}; };
}}; }};