Images cache control code edit

This commit is contained in:
buinsky 2014-12-07 23:50:06 +03:00
parent dbc5ffee75
commit ba40408c8d
2 changed files with 3 additions and 3 deletions

View file

@ -92,9 +92,6 @@ void AbstractRequestHandler::print_impl(const QByteArray& data, const QString& t
if (!response_.headers.contains(HEADER_CONTENT_TYPE)) if (!response_.headers.contains(HEADER_CONTENT_TYPE))
response_.headers[HEADER_CONTENT_TYPE] = type; response_.headers[HEADER_CONTENT_TYPE] = type;
if (type.indexOf("image") > -1)
response_.headers[HEADER_CACHE_CONTROL] = "max-age=3000000";
response_.content += data; response_.content += data;
} }

View file

@ -62,6 +62,7 @@ const QString SCOPE_THEME = "theme";
const QString DEFAULT_ACTION = "index"; const QString DEFAULT_ACTION = "index";
const QString WEBUI_ACTION = "webui"; const QString WEBUI_ACTION = "webui";
const QString VERSION_INFO = "version"; 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 #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; qDebug() << Q_FUNC_INFO << "There icon:" << url;
printFile(url); printFile(url);
header(HEADER_CACHE_CONTROL, MAX_AGE_MONTH);
} }
void RequestHandler::action_public_images() void RequestHandler::action_public_images()
{ {
const QString path = ":/Icons/" + args_.join("/"); const QString path = ":/Icons/" + args_.join("/");
printFile(path); printFile(path);
header(HEADER_CACHE_CONTROL, MAX_AGE_MONTH);
} }
// GET params: // GET params: