diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2019-05-24 19:51:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-24 19:51:01 +0200 |
commit | b0c2042a28780bf75fb413e58c06b1d46b829414 (patch) | |
tree | d64a11b98fb1b4aaaca35a926c1bc2a0f29e4ac6 /lib/private/AppFramework | |
parent | 67432a2141d83a1bb709e54ec774658e820bc8e2 (diff) | |
parent | b0c030cbb58dca4b2d5ba12a98d073587ec6ad3a (diff) | |
download | nextcloud-server-b0c2042a28780bf75fb413e58c06b1d46b829414.tar.gz nextcloud-server-b0c2042a28780bf75fb413e58c06b1d46b829414.zip |
Merge pull request #15714 from nextcloud/fix/204_304_rfc
Check the actual status code for 204 and 304
Diffstat (limited to 'lib/private/AppFramework')
-rw-r--r-- | lib/private/AppFramework/App.php | 10 |
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)) { |