diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-05-30 13:27:16 +0300 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-05-30 13:27:16 +0300 |
commit | 0ec4098955065a0e455d410ca01f9414787ef324 (patch) | |
tree | ec2758e5b25b16d9155a1108fbe6ff9f03ce7a3f /apps | |
parent | 761a0b252cce40b098a62c29d74a124716683b0c (diff) | |
parent | 002a7f829461350a33496cd3a78b4e611d5d2727 (diff) |
Merge pull request #24830 from owncloud/stable9-lenz1111-share_download_range_requests_support
[stable9] lenz1111's fantastic share download range requests support
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/ajax/download.php | 11 | ||||
-rw-r--r-- | apps/files_sharing/lib/controllers/sharecontroller.php | 13 |
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 ea024b6016a..838332b8c83 100644 --- a/apps/files_sharing/lib/controllers/sharecontroller.php +++ b/apps/files_sharing/lib/controllers/sharecontroller.php @@ -478,16 +478,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(); } } |