Enable x-sendfile only if we do not lock the file system

This commit is contained in:
Thomas Müller 2015-06-22 12:07:53 +02:00
parent a9bca9e3aa
commit c74c8eff3a
1 changed files with 8 additions and 4 deletions

View File

@ -43,6 +43,7 @@
// TODO: get rid of this using proper composer packages // TODO: get rid of this using proper composer packages
require_once 'mcnetic/phpzipstreamer/ZipStreamer.php'; require_once 'mcnetic/phpzipstreamer/ZipStreamer.php';
use OC\Lock\NoopLockingProvider;
use OCP\Lock\ILockingProvider; use OCP\Lock\ILockingProvider;
/** /**
@ -86,10 +87,13 @@ class OC_Files {
public static function get($dir, $files, $only_header = false) { public static function get($dir, $files, $only_header = false) {
$view = \OC\Files\Filesystem::getView(); $view = \OC\Files\Filesystem::getView();
$xsendfile = false; $xsendfile = false;
if (isset($_SERVER['MOD_X_SENDFILE_ENABLED']) || if (\OC::$server->getLockingProvider() instanceof NoopLockingProvider) {
isset($_SERVER['MOD_X_SENDFILE2_ENABLED']) || if (isset($_SERVER['MOD_X_SENDFILE_ENABLED']) ||
isset($_SERVER['MOD_X_ACCEL_REDIRECT_ENABLED'])) { isset($_SERVER['MOD_X_SENDFILE2_ENABLED']) ||
$xsendfile = true; isset($_SERVER['MOD_X_ACCEL_REDIRECT_ENABLED'])
) {
$xsendfile = true;
}
} }
if (is_array($files) && count($files) === 1) { if (is_array($files) && count($files) === 1) {