From a9fa20bb910bf89e5760c25ccacd16c42c6c139a Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 28 Jan 2015 11:44:35 +0100 Subject: [PATCH] [ticket/13414] Set Content-Length header only if status is not 304 PHPBB3-13414 --- phpBB/download/file.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index ed33fc0962..cf8aaa03e8 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -509,16 +509,18 @@ function send_file_to_browser($attachment, $upload_dir, $category) } } - if ($size) - { - header("Content-Length: $size"); - } - // Close the db connection before sending the file $db->sql_close(); if (!set_modified_headers($attachment['filetime'], $user->browser)) { + // Send Content-Length only if set_modified_headers() does not send + // status 304 - Not Modified + if ($size) + { + header("Content-Length: $size"); + } + // Try to deliver in chunks @set_time_limit(0);