From 40e0b44409037978b0bce4b451b1569c3bc3ee19 Mon Sep 17 00:00:00 2001
From: Dominik Eckelmann <deckelmann@gmail.com>
Date: Sat, 15 Feb 2014 10:58:33 +0100
Subject: [PATCH] use http_sendfile correct

---
 inc/actions.php         | 2 +-
 inc/fetch.functions.php | 2 +-
 inc/httputils.php       | 8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/inc/actions.php b/inc/actions.php
index 50cbe369f..4dbad1a32 100644
--- a/inc/actions.php
+++ b/inc/actions.php
@@ -697,7 +697,7 @@ function act_sitemap($act) {
 
         // Send file
         //use x-sendfile header to pass the delivery to compatible webservers
-        if (http_sendfile($sitemap)) exit;
+        http_sendfile($sitemap);
 
         readfile($sitemap);
         exit;
diff --git a/inc/fetch.functions.php b/inc/fetch.functions.php
index 3eacaa2fe..c61c54503 100644
--- a/inc/fetch.functions.php
+++ b/inc/fetch.functions.php
@@ -77,7 +77,7 @@ function sendFile($file, $mime, $dl, $cache, $public = false, $orig = null) {
     }
 
     //use x-sendfile header to pass the delivery to compatible webservers
-    if(http_sendfile($file)) exit;
+    http_sendfile($file);
 
     // send file contents
     $fp = @fopen($file, "rb");
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 <chris@jalakai.co.uk>
+ * @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;
     }
-- 
GitLab