Bug #15337
closedWrong Content-Length header implement in TSFE
0%
Description
in tslib_fe
enableContentLengthHeader send Content-Type with strlen($TSFE->content)
Bug #1
it is not filtered empty line and BOM header from php source files.
Bug #2
it send content-type in debug mode.
Bug #3
strlen($this->content) might be wrong,
It should be using ob_get_length() after contents are printed.
sample hot fix can skip #1 and #2 by XCLASS
(tested on apache2, php5, windows xp, typo3 3.8.1)
----
class ux_tslib_fe extends tslib_fe {
function processOutput() {
$enableContentLengthHeader = $this->config['config']['enableContentLengthHeader'];
if (function_exists('ob_get_status')) {
if ((bool) ob_get_status()) {
@ ob_clean(); // removing BOM and space from includes and php file head
}
$this->config['config']['enableContentLengthHeader'] = false;
parent :: processOutput();
if ($enableContentLengthHeader && //
!$this->TYPO3_CONF_VARS['FE']['debug'] && //
!$this->config['config']['debug'] && //
!$this->isEXTincScript() && //
!$this->beUserLogin) {
header('Content-Length: '.strlen($this->content), true);
}
}
}
}
(issue imported from #M2139)
Updated by old_hkdennis2k almost 19 years ago
sorry, wrong snippets given
----
function processOutput() {
$enableContentLengthHeader = $this->config['config']['enableContentLengthHeader'];
$this->config['config']['enableContentLengthHeader'] = false;
if (function_exists('ob_get_status')) {
if ((bool) ob_get_status()) {
@ ob_clean(); // removing BOM and space from includes and php file head
} else {
$enableContentLengthHeader = false;
}
} else {
$enableContentLengthHeader = false;
}
parent :: processOutput();
if ($enableContentLengthHeader && //
!$this->TYPO3_CONF_VARS['FE']['debug'] && //
!$this->config['config']['debug'] && //
!$this->isEXTincScript() && //
!$this->beUserLogin) {
header('Content-Length: '.strlen($this->content), true);
}
}
Updated by Sebastian Kurfuerst almost 19 years ago
Hi,
can you please provide a patch in unified diff format? (diff -u oldfile.php newfile.php > patchfile.patch)
Thanks,
Sebastian
Updated by old_hkdennis2k almost 19 years ago
I have customized the file and I don't think it is is a good patch.
So, I will not submit the patch file.
Addition Note:
IF any other text has been send (e.g. usually by t3lib_div::debug)
config.enableContentLengthHeader must be false.
and ob_clean() should not run if t3lib_div::debug has printed.
Updated by Steffen Gebert almost 13 years ago
- Category deleted (
Communication) - Status changed from New to Closed
- Target version deleted (
0) - TYPO3 Version changed from 3.8.1 to 4.7
- PHP Version deleted (
5)