You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axkit-dev@xml.apache.org by ma...@apache.org on 2004/08/16 17:30:23 UTC
cvs commit: xml-axkit/lib/Apache/AxKit ConfigReader.pm
matts 2004/08/16 08:30:23
Modified: lib/Apache/AxKit ConfigReader.pm
Log:
Make gzipping much more reliable based on
http://devl4.outlook.net/devdoc/Dynagzip/ContentCompressionClients.html
Revision Changes Path
1.20 +33 -6 xml-axkit/lib/Apache/AxKit/ConfigReader.pm
Index: ConfigReader.pm
===================================================================
RCS file: /home/cvs/xml-axkit/lib/Apache/AxKit/ConfigReader.pm,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- ConfigReader.pm 13 Jul 2004 18:05:45 -0000 1.19
+++ ConfigReader.pm 16 Aug 2004 15:30:23 -0000 1.20
@@ -315,8 +315,38 @@
AxKit::Debug(5, 'Should we zip the output?');
my $r = $self->{apache};
- my($can_gzip);
+ return unless $r->header_in('Accept-Encoding') =~ /gzip/io;
+ my $can_gzip;
+ return if $r->protocol =~ /http\/1\.0/i;
+
+ my $ua = $r->header_in('User-Agent');
+ if ($ua =~ /MSIE 4\./) {
+ return if
+ $r->method =~ /POST/i ||
+ $r->header_in('Range') ||
+ length($r->uri) > 245;
+ }
+ elsif ($ua =~ /MSIE 6\.0/) {
+ # Don't gzip https on MSIE 6.0
+ return if $r->parsed_uri->scheme =~ /https/i;
+ }
+
+ # All too buggy to gzip
+ if ($r->header_in('Via') =~ /^1\.1\s/ || # MS Proxy 2.0
+ $r->header_in('Via') =~ /^Squid\// ||
+ $ua =~ /Galean\)/ ||
+ $ua =~ /Mozilla\/4\.7[89]/ ||
+ $ua =~ /Opera 3\.5/ ||
+ $ua =~ /SkipStone\)/)
+ {
+ return;
+ }
+
+ if (($ua =~ /Mozilla\/4\.0/) and (!($ua =~ /compatible/i))) {
+ return;
+ }
+
AxKit::Debug(5, 'Getting Vary header');
my @vary;
@vary = $r->header_out('Vary') if $r->header_out('Vary');
@@ -326,11 +356,8 @@
join ", ",
@vary
);
- my($accept_encoding) = $r->header_in("Accept-Encoding") || '';
- $can_gzip = 1 if index($accept_encoding,"gzip")>=0;
unless ($can_gzip) {
- my $user_agent = $r->header_in("User-Agent");
- if ($user_agent =~ m{
+ if ($ua =~ m{
^Mozilla/
\d+
\.