Issue Bug Closed

#15337Wrong Content-Length header implement in TSFE

old_hkdennis2k 12/30/05, 09:53 updated 12/26/11, 13:30

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)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.