From b0e138d6694410a25b99e324d08d8fd11cbfe3d9 Mon Sep 17 00:00:00 2001 From: buinsky Date: Tue, 25 Nov 2014 12:50:14 +0300 Subject: [PATCH] Set images cache expiry time to 300000 seconds --- src/webui/abstractrequesthandler.cpp | 3 +++ src/webui/httptypes.h | 1 + 2 files changed, 4 insertions(+) diff --git a/src/webui/abstractrequesthandler.cpp b/src/webui/abstractrequesthandler.cpp index 0ec2b73c8..3152532de 100644 --- a/src/webui/abstractrequesthandler.cpp +++ b/src/webui/abstractrequesthandler.cpp @@ -94,6 +94,9 @@ 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/httptypes.h b/src/webui/httptypes.h index 9eabf577c..7fd95c310 100644 --- a/src/webui/httptypes.h +++ b/src/webui/httptypes.h @@ -39,6 +39,7 @@ const QString HEADER_SET_COOKIE = "Set-Cookie"; const QString HEADER_CONTENT_TYPE = "Content-Type"; const QString HEADER_CONTENT_ENCODING = "Content-Encoding"; const QString HEADER_CONTENT_LENGTH = "Content-Length"; +const QString HEADER_CACHE_CONTROL = "Cache-Control"; const QString CONTENT_TYPE_CSS = "text/css; charset=UTF-8"; const QString CONTENT_TYPE_GIF = "image/gif";