From 40e0b44409037978b0bce4b451b1569c3bc3ee19 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sat, 15 Feb 2014 10:58:33 +0100 Subject: use http_sendfile correct --- inc/httputils.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'inc/httputils.php') diff --git a/inc/httputils.php b/inc/httputils.php index ca60ed509..fdf453a8c 100644 --- a/inc/httputils.php +++ b/inc/httputils.php @@ -64,12 +64,13 @@ function http_conditionalRequest($timestamp){ * Let the webserver send the given file via x-sendfile method * * @author Chris Smith + * @param string $file absolute path of file to send * @returns void or exits with previously header() commands executed */ function http_sendfile($file) { global $conf; - //use x-sendfile header to pass the delivery to compatible webservers + //use x-sendfile header to pass the delivery to compatible web servers if($conf['xsendfile'] == 1){ header("X-LIGHTTPD-send-file: $file"); ob_end_clean(); @@ -83,8 +84,6 @@ function http_sendfile($file) { ob_end_clean(); exit; } - - return false; } /** @@ -223,7 +222,8 @@ function http_cached($cache, $cache_ok) { header('Content-Encoding: gzip'); readfile($cache.".gz"); } else { - if (!http_sendfile($cache)) readfile($cache); + http_sendfile($cache); + readfile($cache); } exit; } -- cgit v1.2.3 From 446b5b5934799f1f906ea8903b1e96c981f1c1b2 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sat, 15 Feb 2014 10:59:18 +0100 Subject: FS#2388 give relative path to sendfile on nginx --- inc/httputils.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'inc/httputils.php') diff --git a/inc/httputils.php b/inc/httputils.php index fdf453a8c..d6532720f 100644 --- a/inc/httputils.php +++ b/inc/httputils.php @@ -80,6 +80,8 @@ function http_sendfile($file) { ob_end_clean(); exit; }elseif($conf['xsendfile'] == 3){ + // FS#2388 nginx just needs the relative path. + $file = DOKU_REL.substr($file, strlen(fullpath(DOKU_INC)) + 1); header("X-Accel-Redirect: $file"); ob_end_clean(); exit; -- cgit v1.2.3 From 901248028bc3b7497093ab3853f2f6e347fbc397 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Mon, 17 Feb 2014 19:22:57 +0100 Subject: fix httputils PHPDocs --- inc/httputils.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'inc/httputils.php') diff --git a/inc/httputils.php b/inc/httputils.php index ca60ed509..003733ede 100644 --- a/inc/httputils.php +++ b/inc/httputils.php @@ -64,7 +64,8 @@ function http_conditionalRequest($timestamp){ * Let the webserver send the given file via x-sendfile method * * @author Chris Smith - * @returns void or exits with previously header() commands executed + * @param $file + * @returns bool or exits with previously header() commands executed */ function http_sendfile($file) { global $conf; @@ -92,7 +93,7 @@ function http_sendfile($file) { * * This function exits the running script * - * @param ressource $fh - file handle for an already open file + * @param resource $fh - file handle for an already open file * @param int $size - size of the whole file * @param int $mime - MIME type of the file * @@ -204,7 +205,7 @@ function http_gzip_valid($uncompressed_file) { * * This function handles output of cacheable resource files. It ses the needed * HTTP headers. If a useable cache is present, it is passed to the web server - * and the scrpt is terminated. + * and the script is terminated. */ function http_cached($cache, $cache_ok) { global $conf; -- cgit v1.2.3