Forum Moderators: phranque

Message Too Old, No Replies

How to deflate the requested file

Seems more than expected do not have accept encoding gzip

         

jetteroheller

8:25 pm on Mar 29, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



First line

RewriteCond %{HTTP:accept-encoding} !gzip

And the second line should decompress if the requested file is
*.htm
*.js

and sent it uncompressed

Caterham

10:15 am on Mar 30, 2009 (gmt 0)

10+ Year Member



You can't add an output filter with mod_rewrite (unless you modify the module); you'll have to rewrite to a script which decompresses the file.

jetteroheller

11:13 am on Mar 30, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Okay, I modify my question

Could this look like this?

RewriteCond %{HTTP:accept-encoding} !gzip
RewriteRule .*.(htm)$ http://example.com/cgi-bin/deflate.pl?$1 [R=301,L]

I mean to pass on to a script, as parameters the access string.

Next question, how would this perl module look like?

Caterham

1:17 pm on Mar 30, 2009 (gmt 0)

10+ Year Member



I'd drop the redirect and use an internal rewrite.

how would this perl module look like?

Take a look at Compress::Zlib at CPAN.

jetteroheller

2:56 pm on Mar 30, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just preparing the perl script

#use PerlIO::gzip;

my $buffer = sub_to_laod_a_file ( "../http/index.htm" );

my ($i, $status) = inflateInit();
my ($out, $status) = $i->inflate( $buffer );

$html .= "Buffer length= " . length ( $buffer ) . " OUT= " . length ( $out ) . "STATU=$status";

The length of the buffer indicates, the gz compressed file was successfull loaded

But the $out is 0
Status = -3

Can not find what status -3 means

phranque

10:35 am on Mar 31, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



How to inflate a GZIP in perl [webmasterworld.com]