Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Change Accept-Ranges header
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Dec 12, 2017
1 parent 861b1e7 commit 9e69d4b
Showing 1 changed file with 2 additions and 4 deletions.
Expand Up @@ -242,9 +242,7 @@ public function readFile($node = null, $filePath = null, $data = null, $headerTy


header("Pragma: public");
//header("Expires: -1");
header("Cache-Control: public, must-revalidate, post-check=0, pre-check=0");
//header("Content-Disposition: attachment; filename=\"$file_name\"");

if ($headerType == "plain") {
header("Content-type:text/plain");
Expand All @@ -258,6 +256,8 @@ public function readFile($node = null, $filePath = null, $data = null, $headerTy

} else {

header("Accept-Ranges: bytes");

if ($isFile) {
$this->logDebug("Sending accept range 0-$size");
$tsstring = gmdate('D, d M Y H:i:s ', filemtime($filePathOrData)) . 'GMT';
Expand Down Expand Up @@ -307,7 +307,6 @@ public function readFile($node = null, $filePath = null, $data = null, $headerTy
header('HTTP/1.1 206 Partial Content');
header('Content-Range: bytes ' . $offset . '-' . $dataSizeFromOffset . '/' . $size);
header("Content-Length: ". $length);
header("Accept-Ranges: $offset-".$dataSizeFromOffset);
$file = fopen($filePathOrData, 'rb');
if(!is_resource($file)){
throw new \Exception("Failed opening file ".$filePathOrData);
Expand Down Expand Up @@ -336,7 +335,6 @@ public function readFile($node = null, $filePath = null, $data = null, $headerTy

}
else {
header("Accept-Ranges: 0-$size");
if ($confGzip) {
$gzippedData = ($data?gzencode($filePathOrData,9):gzencode(file_get_contents($filePathOrData), 9));
$size = strlen($gzippedData);
Expand Down

0 comments on commit 9e69d4b

Please sign in to comment.