aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_download.php
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2011-01-13 00:46:19 +0100
committerAndreas Fischer <bantu@phpbb.com>2011-01-17 22:37:53 +0100
commit6bbdc129c09b781007863fc49a9c7f9f3b1cf157 (patch)
tree94dae6125f08a0a52a9e3ed6ecb01297d3a4e50c /phpBB/includes/functions_download.php
parent19931713db35307461bfe0784f32526d24caf912 (diff)
downloadforums-6bbdc129c09b781007863fc49a9c7f9f3b1cf157.tar
forums-6bbdc129c09b781007863fc49a9c7f9f3b1cf157.tar.gz
forums-6bbdc129c09b781007863fc49a9c7f9f3b1cf157.tar.bz2
forums-6bbdc129c09b781007863fc49a9c7f9f3b1cf157.tar.xz
forums-6bbdc129c09b781007863fc49a9c7f9f3b1cf157.zip
[ticket/9790] Support for nginx's X-Accel-Redirect header for attachments.
PHPBB3-9790
Diffstat (limited to 'phpBB/includes/functions_download.php')
-rw-r--r--phpBB/includes/functions_download.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php
index 80b71f1301..4c8f539979 100644
--- a/phpBB/includes/functions_download.php
+++ b/phpBB/includes/functions_download.php
@@ -229,6 +229,16 @@ function send_file_to_browser($attachment, $upload_dir, $category)
if (!set_modified_headers($attachment['filetime'], $user->browser))
{
+ // We make sure those have to be enabled manually by defining a constant
+ // because of the potential disclosure of full attachment path
+ // in case support for features is absent in the webserver software.
+ if (defined('PHPBB_ENABLE_X_ACCEL_REDIRECT') && PHPBB_ENABLE_X_ACCEL_REDIRECT)
+ {
+ // X-Accel-Redirect - http://wiki.nginx.org/XSendfile
+ header('X-Accel-Redirect: ' . $user->page['root_script_path'] . $upload_dir . '/' . $attachment['physical_filename']);
+ exit;
+ }
+
// Try to deliver in chunks
@set_time_limit(0);