summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2019-05-24 13:00:17 +0200
committerMorris Jobke <hey@morrisjobke.de>2019-05-24 15:18:32 +0200
commitb0c030cbb58dca4b2d5ba12a98d073587ec6ad3a (patch)
treeeb6195d5e40e58cba4be2923199bb0c3001309cc /lib
parent96d1921bb343066ee57e3f763fedf2d3811fc702 (diff)
downloadnextcloud-server-b0c030cbb58dca4b2d5ba12a98d073587ec6ad3a.tar.gz
nextcloud-server-b0c030cbb58dca4b2d5ba12a98d073587ec6ad3a.zip
Check the actual status code for 204 and 304
The header is the full http header like: HTTP/1.1 304 Not Modified So comparing this to an int always yields false This also makes the 304 RFC compliant as the resulting content length should otherwise be the length of the message and not 0. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl> Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/AppFramework/App.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/private/AppFramework/App.php b/lib/private/AppFramework/App.php
index 5a9fb0c64fc..6185a35d1d7 100644
--- a/lib/private/AppFramework/App.php
+++ b/lib/private/AppFramework/App.php
@@ -157,7 +157,15 @@ class App {
* https://tools.ietf.org/html/rfc7230#section-3.3
* https://tools.ietf.org/html/rfc7230#section-3.3.2
*/
- if ($httpHeaders !== Http::STATUS_NO_CONTENT && $httpHeaders !== Http::STATUS_NOT_MODIFIED) {
+ $emptyResponse = false;
+ if (preg_match('/^HTTP\/\d\.\d (\d{3}) .*$/', $httpHeaders, $matches)) {
+ $status = (int)$matches[1];
+ if ($status === Http::STATUS_NO_CONTENT || $status === Http::STATUS_NOT_MODIFIED) {
+ $emptyResponse = true;
+ }
+ }
+
+ if (!$emptyResponse) {
if ($response instanceof ICallbackResponse) {
$response->callback($io);
} else if (!is_null($output)) {