CGI-Compress-Gzip
view release on metacpan or search on metacpan
[FIXES]
- Add support for CGI redirect() calls (if HTTP Status is not
200, content should not be compressed).
0.12 22 Aug 2003
[FIXES]
- Headers were altered even when compression was inappropriate.
0.11 14 Mar 2003
[ENHANCEMENTS]
- Handle default content-type of text/html
- Add helpful diagnostic HTTP headers, if requested
0.10 13 Mar 2003
[FIXES]
- Fix for mod_perl -- use in-memory compression
0.04 12 Feb 2003
[FIXES]
- Disable for mod_perl
- Case-insensitive content-encoding tests
lib/CGI/Compress/Gzip.pm view on Meta::CPAN
}
else
{
push @newheader, '-Content_Encoding', 'gzip';
}
$content_type ||= 'text/html';
if (!$self->isCompressibleType($content_type))
{
# Not compressible media
return (0, 'incompatible content-type ' . $content_type);
}
# Check that IO::Zlib is available
if (!defined $global_can_compress)
{
local $SIG{__WARN__} = 'DEFAULT';
local $SIG{__DIE__} = 'DEFAULT';
eval { require IO::Zlib; }; ## no critic (RequireCheckingReturnValueOfEval)
$global_can_compress = $EVAL_ERROR ? 0 : 1;
}
# CGI with charset and compression
{
my $header = CGI->new(q{})->header(-Content_Type => 'text/html; charset=UTF-8');
my $out = `$basecmd -DHTTP_ACCEPT_ENCODING=gzip charset "$compare"`;
msgs_match($out, $gzip . $header . $zcompare, 'Gzipped CGI template with charset');
}
# CGI with arguments
{
my $reason = 'x-non-gzip-reason: incompatible content-type foo/bar' . $eol;
my $header = CGI->new(q{})->header(-Type => 'foo/bar');
my $out = `$basecmd -DHTTP_ACCEPT_ENCODING=gzip type "$compare"`;
msgs_match($out, $reason . $header.$compare, 'Un-Gzipped with -Type flag');
}
# CGI redirection and compression
{
my $reason = 'x-non-gzip-reason: HTTP status not 200' . $eol;
my $expected_header = CGI->new(q{})->redirect($redir);
( run in 3.982 seconds using v1.01-cache-2.11-cpan-524268b4103 )