diff --git a/inc/pageutils.php b/inc/pageutils.php index ccf8d10b87cf80633afb7f6975d643f2edd6e053..1fdb4f2d0c583e8bcb2be4d23d093e2ab5afb735 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -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 : diff --git a/lib/exe/fetch.php b/lib/exe/fetch.php index dd4da459c85883e87690c4ec9a5723f0d745cebf..ddfff4b4e6b3e85b01a6766f65d5c0a133d09b71 100644 --- a/lib/exe/fetch.php +++ b/lib/exe/fetch.php @@ -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');