/usr/man/cat.3/Compress::Zlib.3.Z
NAME
Apache::Compress - Auto-compress web files with Gzip
SYNOPSIS
PerlModule Apache::Compress
# Compress regular files - decides whether to compress by
# examining the Accept-Encoding header
<FilesMatch "\.blah$">
SetHandler perl-script
PerlHandler Apache::Compress
</FilesMatch>
# Compress output of Perl scripts
PerlModule Apache::Filter
<FilesMatch "\.pl$">
SetHandler perl-script
PerlSetVar Filter on
PerlHandler Apache::RegistryFilter Apache::Compress
</FilesMatch>
# Guess based on user-agent
<FilesMatch "\.blah$">
SetHandler perl-script
PerlSetVar CompressDecision User-Agent
PerlHandler Apache::Compress
</FilesMatch>
DESCRIPTION
This module lets you send the content of an HTTP response as gzip-com-
pressed data. Certain browsers (Netscape, IE) can request content com-
pression via the "Accept-Encoding" header. This can speed things up if
you're sending large files to your users through slow connections.
Browsers that don't request gzipped data will receive regular noncom-
pressed data.
Apparently some older browsers (and maybe even some newer ones) actu-
ally support gzip encoding, but don't send the "Accept-Encoding"
header. If you want to try to guess which browsers these are and
encode the content anyway, you can set the "CompressDecision" variable
to "User-Agent". The default "CompressDecision" value is "Header",
which means it will only look at the incoming "Accept-Encoding" header.
Note that the browser-guessing is currently using a regular expression
that I don't think is very good, but I don't know what user agents to
support and which not to. Please send me information if you have any,
especially in the form of a patch. =)
This module is compatibile with Apache::Filter, so you can compress the
output of other content-generators.
TO DO
Compress::Zlib provides a facility for buffering output until there's
enough data for efficient compression. Currently we don't take advan-
tage of this facility, we simply compress the whole content body at
once. We could achieve better memory usage if we changed this (at a
small cost to the compression ratio). See Eagle book, p.185.
AUTHOR
Ken Williams, KWILLIAMS@cpan.org
Partially based on the work of several modules, like Doug MacEachern's
Apache::Gzip (in the Eagle book but not on CPAN), Andreas Koenig's
Apache::GzipChain, and an unreleased module by Geoffrey Young and
Philippe Chiasson.
SEE ALSO
perl(1), mod_perl(1), Apache::Filter(3)
perl v5.8.8 2004-11-17 Compress(3)
See also Compress::Bzip2(3)
See also Compress::Zlib(3)
Man(1) output converted with
man2html