изменил политику кеширования, убрал строковые константы из статистик (пилоты, размер кадра)

This commit is contained in:
2024-11-12 14:13:07 +03:00
parent c0e7e1e300
commit 087da149f1
4 changed files with 47 additions and 42 deletions

View File

@@ -43,6 +43,7 @@ void http::resource::StaticFileFactory::registerFile(const std::string &path, se
void http::resource::StaticFileFactory::serve(const std::string &path, server::Reply &rep) {
for (auto& f: this->files) {
if (f.path == path) {
#ifdef USE_DEBUG
if (f.allowCache) {
rep.content.clear();
rep.content.insert(rep.content.end(), f.content.begin(), f.content.end());
@@ -50,6 +51,10 @@ void http::resource::StaticFileFactory::serve(const std::string &path, server::R
BOOST_LOG_TRIVIAL(debug) << "Reload file " << path << " (http path: " << path << ")";
loadFile(f.path, rep.content);
}
#else
rep.content.clear();
rep.content.insert(rep.content.end(), f.content.begin(), f.content.end());
#endif
rep.status = server::ok;
// rep.headers.clear();
rep.headers.push_back({.name = "Content-Type", .value = server::mime_types::toString(f.type)});