Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions lib/public/AppFramework/Http/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@

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.
Expand Down Expand Up @@ -203,6 +205,18 @@ public function addHeader($name, $value) {
// 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 {
Expand Down