[BUGFIX] Set content-length header to the end of output 68/54268/4
authorBenni Mack <benni@typo3.org>
Mon, 2 Oct 2017 23:34:02 +0000 (01:34 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Tue, 3 Oct 2017 11:02:21 +0000 (13:02 +0200)
Resolves: #76100
Resolves: #65719
Releases: master, 8.7
Change-Id: I2e389dd6ecb497a164a457230f106a64373c1907
Reviewed-on: https://review.typo3.org/54268
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
typo3/sysext/frontend/Classes/Http/RequestHandler.php

index 54ebe58..8a6c5c0 100644 (file)
@@ -3539,17 +3539,6 @@ class TypoScriptFrontendController implements LoggerAwareInterface
                 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
             }
         }
-        // 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!
-        if (
-            (!isset($this->config['config']['enableContentLengthHeader']) || $this->config['config']['enableContentLengthHeader'])
-            && !$this->beUserLogin && !$GLOBALS['TYPO3_CONF_VARS']['FE']['debug']
-            && !$this->config['config']['debug'] && !$this->doWorkspacePreview()
-        ) {
-            header('Content-Length: ' . strlen($this->content));
-        }
     }
 
     /**
index f5ea643..47e93ef 100644 (file)
@@ -263,6 +263,17 @@ class RequestHandler implements RequestHandlerInterface
         }
 
         if ($sendTSFEContent) {
+            // 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!
+            if (
+                (!isset($this->controller->config['config']['enableContentLengthHeader']) || $this->controller->config['config']['enableContentLengthHeader'])
+                && !$this->controller->beUserLogin && !$GLOBALS['TYPO3_CONF_VARS']['FE']['debug']
+                && !$this->controller->config['config']['debug'] && !$this->controller->doWorkspacePreview()
+            ) {
+                header('Content-Length: ' . strlen($this->controller->content));
+            }
             $response->getBody()->write($this->controller->content);
         }
         GeneralUtility::makeInstance(LogManager::class)