Project

General

Profile

Actions

Bug #15337

closed

Wrong Content-Length header implement in TSFE

Added by old_hkdennis2k almost 19 years ago. Updated almost 13 years ago.

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

0%

Estimated time:
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 3 (0 open3 closed)

Related to TYPO3 Core - Bug #14922: TYPO3_CONF_VARS['FE']['compressionLevel'] = true leads to no compression with wrong Content-LengthClosedSebastian Kurfuerst2005-08-11

Actions
Related to TYPO3 Core - Bug #19715: Content-length header is calculated incorrectlyClosed2008-12-18

Actions
Related to TYPO3 Core - Bug #20413: wrong content-length header breaks frontend in case of proxy-usageClosedMichael Stucki2009-05-10

Actions
Actions #1

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);
}
}
Actions #2

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

Actions #3

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.

Actions #4

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)
Actions

Also available in: Atom PDF