[TYPO3-core] RFC: #4379 - pageNotFound_handling ignores forceCharset setting
Martin Kutschker
martin.kutschker-n0spam at no5pam-blackbox.net
Sun Nov 19 11:28:53 CET 2006
Michael Stucki schrieb:
> Hi Martin,
>
>>> Problem:
>>> If $TYPO3_CONF_VARS[FE][pageNotFound_handling] is triggered and pointing
>>> to an URL, TYPO3 ignores the setting of $TYPO3_CONF_VARS[BE][forceCharset
>>> ] and outputs a wrong charset in the header.
>>>
>>> Solution:
>>> - Add support for multy-line $header parameter in
>>> tslib_fe::pageNotFoundHandler()
>>>
>>> - Fetch also the headers of the 404 document
>>>
>>> - Forward only those headers that are specified in $forwardHeaders
>>> (currently this is only the Content-Type which usually contains the
>>> charset on the same line).
>>>
>>> Branches: TYPO3_4-0 and Trunk
>> I think we can do better than fetching the same URL twice:
>>
>> $content = t3lib_div::getURL($code, 0, $headerArr);
>> $header = t3lib_div::getURL($code, 2, $headerArr);
>>
>> As the header is delimited by an empty line (\r\n is net line break) then
>> it should work like this:
>
> Agree, changed that.
>
>> $url = t3lib_div::getURL($code, 1, $headerArr);
>> $n = strpos("\r\n\r\n", $url);
>> $header = substr($url,0,$n+2);
>> $header = substr($url,$n+4);
>
> I agree with your idea, but I really don't like using PHPs str_* functions.
> Don't you find this hard to read?
Not really, but I don't mind if you use split.
>> And the preg_quote is IMHO not necessary. A header may contain nothing
>> that needs to be escaped.
>
> I don't think so. Just picked this example from your message header:
>
> | User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
>
> At least the slash needs to be quoted for sure!
That's true for the content of the header, but you don't need to quote
the names like "User-Agent:" or "Content-Type" and you quote them.
>> Otherwise a +1 by looking at the code.
>
> OK, so I have changed my patch according to your suggestion. Tested it and
> committed to Trunk and TYPO3_4-0. For your information, the change is
> attached again.
Fine.
Masi
More information about the TYPO3-team-core
mailing list