mirror of
https://github.com/nextcloud/server.git
synced 2026-04-21 06:08:46 -04:00
Merge pull request #25747 from nextcloud/XAccelBuffering
Add X-Accel-Buffering header to downloads
This commit is contained in:
commit
fb7f65a687
4 changed files with 8 additions and 2 deletions
|
|
@ -291,6 +291,7 @@ class FilesPlugin extends ServerPlugin {
|
|||
$response->addHeader('OC-Checksum', $checksum);
|
||||
}
|
||||
}
|
||||
$response->addHeader('X-Accel-Buffering', 'no');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -590,9 +590,12 @@ class FilesPluginTest extends TestCase {
|
|||
->willReturn($isClumsyAgent);
|
||||
|
||||
$response
|
||||
->expects($this->once())
|
||||
->expects($this->exactly(2))
|
||||
->method('addHeader')
|
||||
->with('Content-Disposition', $contentDispositionHeader);
|
||||
->withConsecutive(
|
||||
['Content-Disposition', $contentDispositionHeader],
|
||||
['X-Accel-Buffering', 'no']
|
||||
);
|
||||
|
||||
$this->plugin->httpGet($request, $response);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ class Streamer {
|
|||
* @param string $name
|
||||
*/
|
||||
public function sendHeaders($name) {
|
||||
header('X-Accel-Buffering: no');
|
||||
$extension = $this->streamerInstance instanceof ZipStreamer ? '.zip' : '.tar';
|
||||
$fullName = $name . $extension;
|
||||
$this->streamerInstance->sendHeaders($fullName);
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ class OC_Files {
|
|||
}
|
||||
}
|
||||
header('Content-Type: '.$type, true);
|
||||
header('X-Accel-Buffering: no');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue