MKDoc-Apache_Cache
view release on metacpan or search on metacpan
lib/MKDoc/Apache_Cache.pm view on Meta::CPAN
sub _make_cache_friendly
{
my $buf = shift;
$buf ||= '';
my ($headers, $body) = split /\r?\n\r?\n/, $buf, 2;
$headers ||= '';
$body ||= '';
my @o = ();
# Figure out some kind of content_type
my ($content_type) = grep /^content-type\:/i, split (/\r?\n/, $headers);
$content_type ||= 'application/octet-stream';
# Gzip body if content type probably needs gzipping
# Vary: Accept-Encoding is here to tell proxies to keep a separate
# cache for every different Accept-Encoding that is being sent.
$content_type !~ /zip/ and $content_type =~ /(text|xml)/ and do {
$body = Compress::Zlib::memGzip ($body);
push @o, "Content-Encoding: gzip";
push @o, "Vary: Accept-Encoding";
( run in 1.228 second using v1.01-cache-2.11-cpan-524268b4103 )