- follow-up to r84637:
authorchristian.futterlieb <christian.futterlieb@735d13b6-9817-0410-8766-e36946ffe9aa>
Mon, 28 Apr 2014 09:27:26 +0000 (09:27 +0000)
committerchristian.futterlieb <christian.futterlieb@735d13b6-9817-0410-8766-e36946ffe9aa>
Mon, 28 Apr 2014 09:27:26 +0000 (09:27 +0000)
  -> use the already captured content-type
  -> use t3lib_div::trimExplode() instead of explode()

git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/pagenotfoundehandling/trunk@84994 735d13b6-9817-0410-8766-e36946ffe9aa

class.tx_pagenotfoundhandling.php

index 53b3646..2b03e54 100644 (file)
@@ -408,11 +408,15 @@ class tx_pagenotfoundhandling
                     'Referer: ' . t3lib_div::getIndpEnv('TYPO3_REQUEST_URL')
                 );
 
-                $html = t3lib_div::getURL($url, (int) $this->_passthroughContentTypeHeader, $headers);
+                $report = array();
+                $html = t3lib_div::getURL($url, (int) $this->_passthroughContentTypeHeader, $headers, $report);
                 if ($this->_passthroughContentTypeHeader && $html !== null) {
-                    list ($capturedHeaders, $html) = explode(CRLF . CRLF, $html, 2);
-                    if (preg_match('/Content-Type:([^\n]+)/', $capturedHeaders, $matches)) {
-                        header($matches[0]);
+                    // split response header and body
+                    list ($responseHeaders, $html) = t3lib_div::trimExplode(CRLF . CRLF, $html, false, 2);
+
+                    // content-type passthrough
+                    if (array_key_exists('content_type', $report) && strlen($report['content_type'])) {
+                        header('Content-Type: ' . $report['content_type']);
                     }
                 }
                        }