Skip to content
Snippets Groups Projects
Commit 6106ad89 authored by Chris Smith's avatar Chris Smith
Browse files

add http_sendfile() function

- update fetch.php to use the new function

darcs-hash:20090118183600-f07c6-65c818bba58fab8856c9f353ff4953ead9b5221e.gz
parent cb043f52
No related branches found
No related tags found
No related merge requests found
......@@ -578,4 +578,22 @@ function http_conditionalRequest($timestamp){
exit;
}
function http_sendfile($file) {
global $conf;
//use x-sendfile header to pass the delivery to compatible webservers
if($conf['xsendfile'] == 1){
header("X-LIGHTTPD-send-file: $file");
return true;
}elseif($conf['xsendfile'] == 2){
header("X-Sendfile: $file");
return true;
}elseif($conf['xsendfile'] == 3){
header("X-Accel-Redirect: $file");
return true;
}
return false;
}
//Setup VIM: ex: et ts=2 enc=utf-8 :
......@@ -14,6 +14,7 @@
require_once(DOKU_INC.'inc/pageutils.php');
require_once(DOKU_INC.'inc/confutils.php');
require_once(DOKU_INC.'inc/auth.php');
//close sesseion
session_write_close();
if(!defined('CHUNK_SIZE')) define('CHUNK_SIZE',16*1024);
......@@ -136,16 +137,7 @@ function sendFile($file,$mime,$dl,$cache){
}
//use x-sendfile header to pass the delivery to compatible webservers
if($conf['xsendfile'] == 1){
header("X-LIGHTTPD-send-file: $file");
exit;
}elseif($conf['xsendfile'] == 2){
header("X-Sendfile: $file");
exit;
}elseif($conf['xsendfile'] == 3){
header("X-Accel-Redirect: $file");
exit;
}
if (http_sendfile($file)) exit;
//support download continueing
header('Accept-Ranges: bytes');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment