Skip to content

Commit

Permalink
Merge pull request #29403 from owncloud/disable_nginx_buffering_on_do…
Browse files Browse the repository at this point in the history
…wnloads_stable10

[stable10] Disable nginx buffering for file downloads
  • Loading branch information
Vincent Petry authored Nov 6, 2017
2 parents 97c5a7c + 1571dc3 commit 42a4dc5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions apps/dav/lib/Connector/Sabre/FilesPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ function httpGet(RequestInterface $request, ResponseInterface $response) {
if ($checksum !== null && $checksum !== '') {
$response->addHeader('OC-Checksum', $checksum);
}
// disable nginx buffering so big downloads through ownCloud won't
// cause memory problems in the nginx process.
$response->addHeader('X-Accel-Buffering', 'no');
}
}

Expand Down
7 changes: 5 additions & 2 deletions apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,9 +541,12 @@ public function testDownloadHeaders($isClumsyAgent, $contentDispositionHeader) {
->will($this->returnValue($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);
}
Expand Down

0 comments on commit 42a4dc5

Please sign in to comment.