Merge pull request #25747 from nextcloud/XAccelBuffering

Add X-Accel-Buffering header to downloads
This commit is contained in:
blizzz 2022-04-07 15:08:21 +02:00 committed by GitHub
commit fb7f65a687
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 2 deletions

View file

@ -291,6 +291,7 @@ class FilesPlugin extends ServerPlugin {
$response->addHeader('OC-Checksum', $checksum);
}
}
$response->addHeader('X-Accel-Buffering', 'no');
}
/**

View file

@ -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);
}

View file

@ -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);

View file

@ -98,6 +98,7 @@ class OC_Files {
}
}
header('Content-Type: '.$type, true);
header('X-Accel-Buffering: no');
}
/**