From ba40408c8d2368a0559f4bb5d66f675f978807c1 Mon Sep 17 00:00:00 2001 From: buinsky Date: Sun, 7 Dec 2014 23:50:06 +0300 Subject: [PATCH] Images cache control code edit --- src/webui/abstractrequesthandler.cpp | 3 --- src/webui/requesthandler.cpp | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/webui/abstractrequesthandler.cpp b/src/webui/abstractrequesthandler.cpp index 1eec6cdd8..6d6fa1c8b 100644 --- a/src/webui/abstractrequesthandler.cpp +++ b/src/webui/abstractrequesthandler.cpp @@ -92,9 +92,6 @@ void AbstractRequestHandler::print_impl(const QByteArray& data, const QString& t if (!response_.headers.contains(HEADER_CONTENT_TYPE)) response_.headers[HEADER_CONTENT_TYPE] = type; - if (type.indexOf("image") > -1) - response_.headers[HEADER_CACHE_CONTROL] = "max-age=3000000"; - response_.content += data; } diff --git a/src/webui/requesthandler.cpp b/src/webui/requesthandler.cpp index 092bd11e3..3b56c6daf 100644 --- a/src/webui/requesthandler.cpp +++ b/src/webui/requesthandler.cpp @@ -62,6 +62,7 @@ const QString SCOPE_THEME = "theme"; const QString DEFAULT_ACTION = "index"; const QString WEBUI_ACTION = "webui"; const QString VERSION_INFO = "version"; +const QString MAX_AGE_MONTH = "public, max-age=2592000"; #define ADD_ACTION(scope, action) actions[#scope][#action] = &RequestHandler::action_##scope##_##action @@ -178,12 +179,14 @@ void RequestHandler::action_public_theme() qDebug() << Q_FUNC_INFO << "There icon:" << url; printFile(url); + header(HEADER_CACHE_CONTROL, MAX_AGE_MONTH); } void RequestHandler::action_public_images() { const QString path = ":/Icons/" + args_.join("/"); printFile(path); + header(HEADER_CACHE_CONTROL, MAX_AGE_MONTH); } // GET params: