Skip to content
Snippets Groups Projects
Commit a2f9bef5 authored by Benni Mack's avatar Benni Mack
Browse files

[TASK] Allow setting ContentLength response header in debug mode

Since TYPO3 v11, the "debug" information
from config.debug = 1 is added at a HTTP Header
Level, and not as HTML comment, thus the additional
check to enable content length as HTTP header
does not need to respect this option anymore.

Additional checks might be removed as well at a later point.

Resolves: #97000
Related: #95103
Related: #82419
Releases: main
Change-Id: I088314bea446971e62e96eacbc383db49e1ad311
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/73649


Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarOliver Bartsch <bo@cedev.de>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: default avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
parent ba33e4cb
No related merge requests found
......@@ -24,10 +24,11 @@ use Psr\Http\Server\RequestHandlerInterface;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
/**
* Send content-length header.
* Notice that all HTML content outside the length of the content-length header will be cut off!
* Therefore content of unknown length from included PHP-scripts and if admin users are logged
* in (admin panel might show...) or if debug mode is turned on, we disable it!
* Add content-length HTTP header to the response.
*
* Notice that all Content outside the length of the content-length header will be cut off!
* Therefore content of unknown length from later-on middlewares and if admin users are logged
* in (admin panel might show...), we disable it!
*
* @internal
*/
......@@ -47,8 +48,7 @@ class ContentLengthResponseHeader implements MiddlewareInterface
if ($GLOBALS['TSFE'] instanceof TypoScriptFrontendController) {
if (
(!isset($GLOBALS['TSFE']->config['config']['enableContentLengthHeader']) || $GLOBALS['TSFE']->config['config']['enableContentLengthHeader'])
&& !$GLOBALS['TSFE']->isBackendUserLoggedIn() && !($GLOBALS['TYPO3_CONF_VARS']['FE']['debug'] ?? false)
&& !($GLOBALS['TSFE']->config['config']['debug'] ?? false) && !$GLOBALS['TSFE']->doWorkspacePreview()
&& !$GLOBALS['TSFE']->isBackendUserLoggedIn() && !$GLOBALS['TSFE']->doWorkspacePreview()
) {
$response = $response->withHeader('Content-Length', (string)$response->getBody()->getSize());
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment