summaryrefslogtreecommitdiffstats
path: root/apps/media
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-08-02 17:02:27 +0200
committerRobin Appelman <icewind1991@gmail.com>2011-08-02 17:02:27 +0200
commit957b9e8b8416377da7c25c0dc31e7b18c644cb6a (patch)
treea6413f06e84ab90eec91c0dc3f96cd0f26cf9ced /apps/media
parent900adb35d8a712809c6ed36f2a9b9b26285bdb7f (diff)
downloadnextcloud-server-957b9e8b8416377da7c25c0dc31e7b18c644cb6a.tar.gz
nextcloud-server-957b9e8b8416377da7c25c0dc31e7b18c644cb6a.zip
send last modified header for media
Diffstat (limited to 'apps/media')
-rw-r--r--apps/media/ajax/api.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/apps/media/ajax/api.php b/apps/media/ajax/api.php
index 8fcabbf840e..6014e4976c0 100644
--- a/apps/media/ajax/api.php
+++ b/apps/media/ajax/api.php
@@ -125,11 +125,19 @@ if($arguments['action']){
OC_MEDIA_COLLECTION::registerPlay($songId);
header('Content-Type:'.$ftype);
+ // calc an offset of 24 hours
+ $offset = 3600 * 24;
+ // calc the string in GMT not localtime and add the offset
+ $expire = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";
+ //output the HTTP header
+ Header($expire);
header('Expires: 0');
- header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
+ header('Cache-Control: max-age=3600, must-revalidate');
header('Pragma: public');
header('Accept-Ranges: bytes');
header('Content-Length: '.OC_Filesystem::filesize($arguments['path']));
+ $gmt_mtime = gmdate('D, d M Y H:i:s', OC_Filesystem::filemtime($arguments['path']) ) . ' GMT';
+ header("Last-Modified: " . $gmt_mtime );
OC_Filesystem::readfile($arguments['path']);
exit;