0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-16 08:58:20 +02: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
m::resource::response
{
client, http::OK, content_type, file_size
client,
http::OK,
content_type,
file_size,
addl_headers,
};
size_t sent{0}, read

View file

@ -327,10 +327,15 @@ get__thumbnail_local(client &client,
"Unknown reason",
};
static const auto &addl_headers
{
"Cache-Control: public, max-age=31536000, immutable\r\n"_sv
};
if(fallback)
return m::resource::response
{
client, buf, content_type
client, buf, content_type, http::OK, addl_headers
};
const auto closure{[&client, &content_type]
@ -338,7 +343,7 @@ get__thumbnail_local(client &client,
{
m::resource::response
{
client, buf, content_type
client, buf, content_type, http::OK, addl_headers
};
}};