Project

General

Profile

Actions

Bug #76100

closed

Design problem with sending of header "Content-Length"

Added by Xavier Perseguers almost 8 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
-
Target version:
-
Start date:
2016-05-09
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
hard
Is Regression:
No
Sprint Focus:

Description

Any extension registering a hook in TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['hook_eofe'] may potentially totally break the output if config.enableContentLengthHeader = 1 (default since TYPO3 6.2) and no be user is logged in because the header "Content-Length" is then sent to the client and the length of the content is calculated in TSFE before the hooks are being called.

If the content is shortened, then the browser will wait until a timeout for extra content to be sent. If the content is made longer (e.g. in my case with an old version of EXT:solr trying to add extra JS plus 2 line breaks before the @</body>), the browser will truncate the output to the advertised length, resulting into a broken HTML to be interpreted.

(In my case) those 2 extra line breaks = 2 bytes made the end </html> tag truncated to </htm. Every browser except IE11 under Windows 10 (!) silently fixed it but IE11 under Windows 10 somehow remembered the extra payload l> and prefixed it to the next asset fetched, most probably because of using pipelining with the connection. This resulted into a broken CSS and a non-branded intranet page in addition to a connection timeout of 15 seconds!

I don't know what to do here exactly but this is an extremely dangerous hook if the developer is not really aware of this issue.


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Feature #19732: Enable "Content-length" header by defaultClosed2008-12-22

Actions
Related to TYPO3 Core - Bug #65719: FE content-length header set too earlyClosed2015-03-13

Actions
Actions #1

Updated by Xavier Perseguers almost 8 years ago

(just added references to tickets which were found by googling and very slowly led me to the actual problem in TYPO3 core so that others may have a chance to find this ticket as well)

Actions #2

Updated by Martin Kutschker over 7 years ago

Possible solutions:

  • move the content length calulation after the hook
  • disable the content length header if a hook is present
  • recalculate the content length if a hook is present
Actions #3

Updated by Tymoteusz Motylewski almost 7 years ago

  • Related to Bug #65719: FE content-length header set too early added
Actions #4

Updated by Gerrit Code Review over 6 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54268

Actions #5

Updated by Gerrit Code Review over 6 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54268

Actions #6

Updated by Gerrit Code Review over 6 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54268

Actions #7

Updated by Gerrit Code Review over 6 years ago

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54269

Actions #8

Updated by Benni Mack over 6 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #9

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF