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

Commit

Permalink
A Small fix on a send header instruction to implement a header to lig…
Browse files Browse the repository at this point in the history
  • Loading branch information
joubertredrat committed Aug 26, 2013
1 parent 7ea4724 commit 1a19f2d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/src/plugins/access.fs/class.fsAccessDriver.php
Expand Up @@ -1231,7 +1231,13 @@ function readFile($filePathOrData, $headerType="plain", $localName="", $data=fal
if($this->getFilteredOption("USE_XSENDFILE", $this->repository->getId()) && $this->wrapperClassName == "fsAccessWrapper"){
if(!$realfileSystem) $filePathOrData = fsAccessWrapper::getRealFSReference($filePathOrData);
$filePathOrData = str_replace("\\", "/", $filePathOrData);
header("X-Sendfile: ".SystemTextEncoding::toUTF8($filePathOrData));
$server_name = $_SERVER["SERVER_SOFTWARE"];
$regex = '/^(lighttpd\/1.4).([0-9]{2}$|[0-9]{3}$|[0-9]{4}$)+/';
if(preg_match($regex, $server_name))
$header_sendfile = "X-LIGHTTPD-send-file";
else
$header_sendfile = "X-Sendfile";
header($header_sendfile.": ".SystemTextEncoding::toUTF8($filePathOrData));
header("Content-type: application/octet-stream");
header('Content-Disposition: attachment; filename="' . basename($filePathOrData) . '"');
return;
Expand Down

0 comments on commit 1a19f2d

Please sign in to comment.