]> source.dussan.org Git - nextcloud-server.git/commitdiff
send last modified header for media
authorRobin Appelman <icewind1991@gmail.com>
Tue, 2 Aug 2011 15:02:27 +0000 (17:02 +0200)
committerRobin Appelman <icewind1991@gmail.com>
Tue, 2 Aug 2011 15:02:27 +0000 (17:02 +0200)
apps/media/ajax/api.php

index 8fcabbf840eaffb893d97fa94686c137510bdf0e..6014e4976c0e6eb7433a9c5893feffe322dc20ad 100644 (file)
@@ -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;