[BUGFIX] Fix display of HTTP headers using pageNotFound handler 76/50876/4
authorMichael Oehlhof <typo3@oehlhof.de>
Fri, 21 Oct 2016 19:28:16 +0000 (21:28 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 3 Dec 2016 17:37:03 +0000 (18:37 +0100)
When using the pageNotFound handler with a curl proxy there are no longer
HTTP headers displayed.

Resolves: #67136
Releases: 7.6
Change-Id: I7c6a9fa3bffbd265345e1a7bfa3ebf25bb2d80b9
Reviewed-on: https://review.typo3.org/50876
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php

index 61cb01b..35f77c6 100644 (file)
@@ -2145,6 +2145,10 @@ class TypoScriptFrontendController
             $res = GeneralUtility::getUrl($code, 1, $headerArr);
             // Header and content are separated by an empty line
             list($header, $content) = explode(CRLF . CRLF, $res, 2);
+            // There can be multiple header blocks when using a proxy with cURL
+            while (substr($content, 0, 4) === 'HTTP') {
+                list($header, $content) = explode(CRLF . CRLF, $content, 2);
+            }
             $content .= CRLF;
             if (false === $res) {
                 // Last chance -- redirect