diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2020-12-16 10:28:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-16 10:28:09 +0100 |
commit | 7a774930388d3214be810c0f40e7d58f4109b455 (patch) | |
tree | e94834dc758021d35a88b275b9182c06e90f0ef7 /lib | |
parent | 4c133f2bd29c697414f82beb12e5b3fdf1a0ba22 (diff) | |
parent | 329ffa257e1b91a544f0e2d98af4e2ebfbcc6283 (diff) | |
download | nextcloud-server-7a774930388d3214be810c0f40e7d58f4109b455.tar.gz nextcloud-server-7a774930388d3214be810c0f40e7d58f4109b455.zip |
Merge pull request #24706 from nextcloud/bugfix/noid/log-error-on-setting-custom-headers-on-no-content-responses
Log an error when setting a custom header on "Not Modified" responses
Diffstat (limited to 'lib')
-rw-r--r-- | lib/public/AppFramework/Http/Response.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/public/AppFramework/Http/Response.php b/lib/public/AppFramework/Http/Response.php index ff6b97f87b1..fc3ee739773 100644 --- a/lib/public/AppFramework/Http/Response.php +++ b/lib/public/AppFramework/Http/Response.php @@ -38,6 +38,8 @@ namespace OCP\AppFramework\Http; use OCP\AppFramework\Http; use OCP\AppFramework\Utility\ITimeFactory; +use OCP\IConfig; +use Psr\Log\LoggerInterface; /** * Base class for responses. Also used to just send headers. @@ -203,6 +205,18 @@ class Response { // to be able to reliably check for security // headers + if ($this->status === Http::STATUS_NOT_MODIFIED + && stripos($name, 'x-') === 0) { + /** @var IConfig $config */ + $config = \OC::$server->get(IConfig::class); + + if ($config->getSystemValueBool('debug', false)) { + \OC::$server->get(LoggerInterface::class)->error( + 'Setting a custom header on a 204 or 304 is not supported' + ); + } + } + if (is_null($value)) { unset($this->headers[$name]); } else { |