GzipChain.pm

filter: Statementstmt 83.3% 10 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 87.5% 14 / 16 CC 1 SCAR 0.7
CC
1
Cov
83%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« PassFile.pm ↑ Summary
1 package Apache::GzipChain;
2 2 ▶use Compress::Zlib 1.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use vars qw(@ISA $VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 $VERSION = "1.20";
6  
7 0 ▶use Apache::OutputChain;
Subroutine BEGIN: called CC=1 SCAR=2.6
8 @ISA = qw( Apache::OutputChain );
9  
10 sub handler {
11 my($r) = shift;
12 my($can_gzip);
13 if ($r->dir_config('GzipForce')) {
14 $can_gzip = 1;
15 } else {
16 my @vary;
17 @vary = $r->header_out('Vary') if $r->header_out('Vary');
18 push @vary, "Accept-Encoding";
19 $r->header_out('Vary',
20 join ", ",
21 @vary
22 );
23 my($accept_encoding) = $r->header_in("Accept-Encoding") || "";
24 $can_gzip = 1 if index($accept_encoding,"gzip")>=0;
25 }
26 if ($can_gzip) {
27 $r->header_out('Content-Encoding','gzip');
28 Apache::OutputChain::handler($r, 'Apache::GzipChain');
29 }
30 }
31  
32 sub PRINT {
33 my $self = shift;
34 my $res = join "", @_;
35 return unless length($res);
36 # srezic in RT 28732: Maybe it would also be appropriate to issue
37 # a warning a la "wide character in PRINT", because I consider it
38 # an error to have utf8-flagged characters in this stage.
39 $self->Apache::OutputChain::PRINT(Compress::Zlib::memGzip($res));
40 }
41  
42 1;
43  
44 __END__
« PassFile.pm ↑ Summary