Skip to content

Commit

Permalink
Item13375: fixed setting the content-encoding
Browse files Browse the repository at this point in the history
... under each and every circumstance
  • Loading branch information
MichaelDaum committed Apr 15, 2015
1 parent fae660e commit bbba93e
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions core/lib/Foswiki.pm
Expand Up @@ -1002,19 +1002,12 @@ sub generateHTTPHeaders {
# add http compression and conditional cache controls
if ( !$this->inContext('command_line') && $text ) {

if (
$Foswiki::cfg{HttpCompress}
&& (
(
$ENV{'HTTP_ACCEPT_ENCODING'}
&& $ENV{'HTTP_ACCEPT_ENCODING'} =~ m/(x-gzip|gzip)/i
)

|| $ENV{'SPDY'}
)
) # SMELL: non-standard way to detect spdy protocol set by web server
{
my $encoding = $1 || 'gzip';
if ( $Foswiki::cfg{HttpCompress}
&& ( $ENV{'HTTP_ACCEPT_ENCODING'} || $ENV{'SPDY'} ) )
{ # SMELL: SPDY is a non-standard way to detect spdy protocol set by web server
my $encoding = $ENV{'HTTP_ACCEPT_ENCODING'} || 'gzip';
$encoding =~ s/^.*(x-gzip|gzip).*/$1/g;

$hopts->{'Content-Encoding'} = $encoding;
$hopts->{'Vary'} = 'Accept-Encoding';

Expand Down

0 comments on commit bbba93e

Please sign in to comment.