From ff4f5ee7a60096f8c57271eea2986f73a52da025 Mon Sep 17 00:00:00 2001
From: Ben Coburn <btcoburn@silicodon.net>
Date: Wed, 15 Mar 2006 13:02:48 +0100
Subject: [PATCH] fixed bug where '304 Not Modified' worked every other time
 because cache headers were not sent

darcs-hash:20060315120248-05dcb-5d5d4e06d0074a687185131cda2000b914346e19.gz
---
 lib/exe/fetch.php | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/exe/fetch.php b/lib/exe/fetch.php
index 390e77bfc..87c47d7cb 100644
--- a/lib/exe/fetch.php
+++ b/lib/exe/fetch.php
@@ -82,11 +82,12 @@
 function sendFile($file,$mime){
   // send headers
   header("Content-Type: $mime");
-  http_conditionalRequest(filemtime($file));
-  list($start,$len) = http_rangeRequest(filesize($file));
   header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
   header('Pragma: public');
   header('Accept-Ranges: bytes');
+  //send important headers first, script stops here if '304 Not Modified' response
+  http_conditionalRequest(filemtime($file));
+  list($start,$len) = http_rangeRequest(filesize($file));
 
   //application mime type is downloadable
   if(substr($mime,0,11) == 'application'){
-- 
GitLab