Cleanup Request processing
This commit is contained in:
parent
e75e8effc1
commit
abaa34d2f1
@ -20,23 +20,15 @@ class Range extends \OCA\Office\Download {
|
|||||||
$ranges = explode(',', substr($_SERVER['HTTP_RANGE'], 6));
|
$ranges = explode(',', substr($_SERVER['HTTP_RANGE'], 6));
|
||||||
foreach ($ranges as $range){
|
foreach ($ranges as $range){
|
||||||
$parts = explode('-', $range);
|
$parts = explode('-', $range);
|
||||||
if (isset($parts[0])){
|
|
||||||
$start = $parts[0];
|
|
||||||
} else {
|
|
||||||
$start = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($parts[1])){
|
$start = isset($parts[0]) ? $parts[0] : 0;
|
||||||
$end = $parts[1];
|
$end = isset($parts[1]) ? $parts[1] : $this->getFilesize() - 1;
|
||||||
} else {
|
|
||||||
$end = $this->getFilesize() - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($start > $end){
|
if ($start > $end){
|
||||||
$this->sendNotSatisfiable();
|
$this->sendNotSatisfiable();
|
||||||
}
|
}
|
||||||
|
|
||||||
$handle = \OC\Files\Filesystem::fopen($this->filepath, 'r');
|
$handle = \OC\Files\Filesystem::fopen($this->filepath, 'rb');
|
||||||
\fseek($handle, $start);
|
\fseek($handle, $start);
|
||||||
$buffer = \fread($handle, $end - $start);
|
$buffer = \fread($handle, $end - $start);
|
||||||
$md5Sum = md5($buffer);
|
$md5Sum = md5($buffer);
|
||||||
@ -49,6 +41,7 @@ class Range extends \OCA\Office\Download {
|
|||||||
header("Connection: close");
|
header("Connection: close");
|
||||||
header("Content-type: " . $this->getMimeType());
|
header("Content-type: " . $this->getMimeType());
|
||||||
header('Content-Disposition: attachment; filename=' . $this->getFilename());
|
header('Content-Disposition: attachment; filename=' . $this->getFilename());
|
||||||
|
\OC_Util::obEnd();
|
||||||
echo $buffer;
|
echo $buffer;
|
||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ class Simple extends \OCA\Office\Download {
|
|||||||
|
|
||||||
\OC_Util::obEnd();
|
\OC_Util::obEnd();
|
||||||
\OC\Files\Filesystem::readfile($this->filepath);
|
\OC\Files\Filesystem::readfile($this->filepath);
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user