Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(AppFramework): Fix error message about 204 not allowing custom headers #44726

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

provokateurin
Copy link
Member

@provokateurin provokateurin commented Apr 8, 2024

Summary

204 does allow custom headers, only 304 forbids them:

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 custom header on a 204 or 304 is not supported (Header: {header})', [
'header' => $name,
]);
}
}

For reference: nextcloud/openapi-extractor#111

Checklist

Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/symfony/symfony/blob/7.1/src/Symfony/Component/HttpFoundation/Response.php#L246-L249
Symfony also only removes the content related headers, so others seem okay.

@provokateurin provokateurin merged commit 25847bd into master Apr 8, 2024
157 checks passed
@provokateurin provokateurin deleted the fix/appframework/204-custom-header-message branch April 8, 2024 15:13
@nickvergessen
Copy link
Member

/backport to stable29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants