Bug #15337

Wrong Content-Length header implement in TSFE

Added by old_hkdennis2k almost 14 years ago. Updated almost 8 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2005-12-30
Due date:
% Done:

0%

TYPO3 Version:
4.7
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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)


Related issues

Related to TYPO3 Core - Bug #14922: TYPO3_CONF_VARS['FE']['compressionLevel'] = true leads to no compression with wrong Content-Length Closed 2005-08-11
Related to TYPO3 Core - Bug #19715: Content-length header is calculated incorrectly Closed 2008-12-18
Related to TYPO3 Core - Bug #20413: wrong content-length header breaks frontend in case of proxy-usage Closed 2009-05-10

History

#1 Updated by old_hkdennis2k almost 14 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);
}
}

#2 Updated by Sebastian Kurfuerst almost 14 years ago

Hi,
can you please provide a patch in unified diff format? (diff -u oldfile.php newfile.php > patchfile.patch)

Thanks,
Sebastian

#3 Updated by old_hkdennis2k almost 14 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.

#4 Updated by Steffen Gebert almost 8 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)

Also available in: Atom PDF