summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2017-05-02 12:30:34 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2017-05-02 12:30:34 +0200
commit59e27f03b641e6048416b4ff252a66adc88100f7 (patch)
treecb8b668127c4b9cb1545cc7a23ddb62a73d262d6 /apps
parent94c2f12226ed005fc2a1e9c440ec70346e9c272a (diff)
downloadnextcloud-server-59e27f03b641e6048416b4ff252a66adc88100f7.tar.gz
nextcloud-server-59e27f03b641e6048416b4ff252a66adc88100f7.zip
Add caching to the imageexport plugin
Since we now heavily use this endpoint for the contacts menu we better set proper caching on the images. Else this gets reload over and over again leading to slow loading menu and unneded bytes transfered. * cache for 1 hour by default * added ETag for validation Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/CardDAV/ImageExportPlugin.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/apps/dav/lib/CardDAV/ImageExportPlugin.php b/apps/dav/lib/CardDAV/ImageExportPlugin.php
index e48410d26d6..3ad7983451b 100644
--- a/apps/dav/lib/CardDAV/ImageExportPlugin.php
+++ b/apps/dav/lib/CardDAV/ImageExportPlugin.php
@@ -86,6 +86,11 @@ class ImageExportPlugin extends ServerPlugin {
}
if ($result = $this->getPhoto($node)) {
+ // Allow caching
+ $response->setHeader('Cache-Control', 'private, max-age=3600, must-revalidate');
+ $response->setHeader('Etag', $node->getETag() );
+ $response->setHeader('Pragma', 'public');
+
$response->setHeader('Content-Type', $result['Content-Type']);
$response->setHeader('Content-Disposition', 'attachment');
$response->setStatus(200);