summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-05-23 21:01:26 +0200
committerVincent Petry <pvince81@owncloud.com>2016-05-23 21:01:26 +0200
commitadcf942901fd567d97dbe105e8f3dfb7cea738e3 (patch)
tree3f3721d872941383689ba8ff661960d521af69c4 /apps
parent5a8af2f0be87cada2827ee3b86d2900146a62f77 (diff)
parent6577bbe887840889e16634b9bf1c4ce247ec265e (diff)
downloadnextcloud-server-adcf942901fd567d97dbe105e8f3dfb7cea738e3.tar.gz
nextcloud-server-adcf942901fd567d97dbe105e8f3dfb7cea738e3.zip
Merge pull request #24750 from owncloud/lenz1111-share_download_range_requests_support
Http Range requests support in downloads
Diffstat (limited to 'apps')
-rw-r--r--apps/files/ajax/download.php11
-rw-r--r--apps/files_sharing/lib/controllers/sharecontroller.php13
2 files changed, 21 insertions, 3 deletions
diff --git a/apps/files/ajax/download.php b/apps/files/ajax/download.php
index 28ce4c6542e..aedd86b6419 100644
--- a/apps/files/ajax/download.php
+++ b/apps/files/ajax/download.php
@@ -50,4 +50,13 @@ if(isset($_GET['downloadStartSecret'])
setcookie('ocDownloadStarted', $_GET['downloadStartSecret'], time() + 20, '/');
}
-OC_Files::get($dir, $files_list, $_SERVER['REQUEST_METHOD'] == 'HEAD');
+$server_params = array( 'head' => \OC::$server->getRequest()->getMethod() == 'HEAD' );
+
+/**
+ * Http range requests support
+ */
+if (isset($_SERVER['HTTP_RANGE'])) {
+ $server_params['range'] = \OC::$server->getRequest()->getHeader('Range');
+}
+
+OC_Files::get($dir, $files_list, $server_params);
diff --git a/apps/files_sharing/lib/controllers/sharecontroller.php b/apps/files_sharing/lib/controllers/sharecontroller.php
index 72294f6b26f..8662765d196 100644
--- a/apps/files_sharing/lib/controllers/sharecontroller.php
+++ b/apps/files_sharing/lib/controllers/sharecontroller.php
@@ -484,16 +484,25 @@ class ShareController extends Controller {
$this->emitAccessShareHook($share);
+ $server_params = array( 'head' => $this->request->getMethod() == 'HEAD' );
+
+ /**
+ * Http range requests support
+ */
+ if (isset($_SERVER['HTTP_RANGE'])) {
+ $server_params['range'] = $this->request->getHeader('Range');
+ }
+
// download selected files
if (!is_null($files) && $files !== '') {
// FIXME: The exit is required here because otherwise the AppFramework is trying to add headers as well
// after dispatching the request which results in a "Cannot modify header information" notice.
- OC_Files::get($originalSharePath, $files_list, $_SERVER['REQUEST_METHOD'] == 'HEAD');
+ OC_Files::get($originalSharePath, $files_list, $server_params);
exit();
} else {
// FIXME: The exit is required here because otherwise the AppFramework is trying to add headers as well
// after dispatching the request which results in a "Cannot modify header information" notice.
- OC_Files::get(dirname($originalSharePath), basename($originalSharePath), $_SERVER['REQUEST_METHOD'] == 'HEAD');
+ OC_Files::get(dirname($originalSharePath), basename($originalSharePath), $server_params);
exit();
}
}