Browse Source

Set images cache expiry time to 300000 seconds

adaptive-webui-19844
buinsky 10 years ago
parent
commit
b0e138d669
  1. 3
      src/webui/abstractrequesthandler.cpp
  2. 1
      src/webui/httptypes.h

3
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)) 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;
} }

1
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_TYPE = "Content-Type";
const QString HEADER_CONTENT_ENCODING = "Content-Encoding"; const QString HEADER_CONTENT_ENCODING = "Content-Encoding";
const QString HEADER_CONTENT_LENGTH = "Content-Length"; 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_CSS = "text/css; charset=UTF-8";
const QString CONTENT_TYPE_GIF = "image/gif"; const QString CONTENT_TYPE_GIF = "image/gif";

Loading…
Cancel
Save