Project

General

Profile

Actions

Bug #29699

closed

t3lib_Compressor does not properly test for gzip support

Added by Xavier Perseguers about 13 years ago. Updated almost 10 years ago.

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

0%

Estimated time:
TYPO3 Version:
4.6
PHP Version:
Tags:
Complexity:
medium
Is Regression:
No
Sprint Focus:

Description

Method returnFileReference() in t3lib_Compressor tests for browser support before actually allowing a CSS or JS compressed file to be returned to the client:

    // if the client accepts gzip and we can create gzipped files, we give him compressed versions
if ($this->createGzipped && strpos(t3lib_div::getIndpEnv('HTTP_ACCEPT_ENCODING'), 'gzip') !== FALSE) {
    return $filename . '.gzip';
} else {
    return $filename;
}

This works fine from a BE perspective but fails in Frontend because the first client will trigger the caching framework and the result will be cached and reused for all following visits. If the first client supports gzip but the second one not, the site will be broken. If this is the other way around, then the download experience will be suboptimal.

Actions #1

Updated by Steffen Gebert about 13 years ago

One solution could be like what we implemented for EXT:scriptmerger:

# take normal file if compression isn't possible
RewriteCond %{HTTP:accept-encoding} !.*(x-)?gzip.* [NC]
RewriteRule ^typo3temp/scriptmerger/compressed/(.+)\.gz\.(js|css) typo3temp/scriptmerger/uncompressed/$1.$2 [L,NC]

However, we would have to do it the other way around: If gzip is supported and a .gzip file exists, then use it (as otherwise installations without the RewriteRules will break.

Actions #2

Updated by Mathias Schreiber almost 10 years ago

  • Status changed from New to Needs Feedback
  • Assignee set to Xavier Perseguers
  • Is Regression set to No

Hey Xavier,

is this still the case?

Actions #3

Updated by Xavier Perseguers almost 10 years ago

Hey Mats,

I don't remember under which circumstance it broke for me but I never had this problem again so I'd say it's safe to close this ticket.

Actions #4

Updated by Alexander Opitz almost 10 years ago

  • Status changed from Needs Feedback to Closed
  • Assignee deleted (Xavier Perseguers)

Thanks for feedback.

Actions

Also available in: Atom PDF