Branch Coverage

blib/lib/CGI/Buffer.pm
Criterion Covered Total %
branch 14 372 3.7


line true false branch
101 6 0 if (not defined $ENV{'SERVER_PROTOCOL'} or $ENV{'SERVER_PROTOCOL'} eq "HTTP/1.0")
108 6 0 if (defined $^V and $^V ge "v5.14.0")
109 0 6 if ${^GLOBAL_PHASE} eq "DESTRUCT"
112 0 6 if ($logger)
113 0 0 if ($ENV{'HTTP_IF_NONE_MATCH'})
116 0 0 if ($ENV{'HTTP_IF_MODIFIED_SINCE'})
135 6 0 unless ($headers or is_cached())
136 0 6 if ($logger)
139 6 0 unless (defined $headers)
143 6 0 unless (defined $status)
152 0 0 if ($ENV{'REQUEST_METHOD'} and $ENV{'REQUEST_METHOD'} eq 'HEAD') { }
158 0 0 if ($headers)
162 0 0 if (defined $body and $body eq '') { }
0 0 elsif (defined $content_type[0] and lc $content_type[0] eq 'text' and lc($content_type[1]) =~ /^html/u and defined $body) { }
166 0 0 if ($cache)
171 0 0 if ($optimise_content)
175 0 0 if ($logger)
182 0 0 if ($optimise_content == 1) { }
188 0 0 if $newlength >= $oldlength
197 0 0 unless (defined $info)
198 0 0 if ($cache) { }
208 0 0 unless ($protocol)
237 0 0 if ($optimise_content >= 2)
244 0 0 if ($optimise_content >= 2)
250 0 0 if $newlength >= $oldlength
255 0 0 if ($lint_content)
259 0 0 if ($logger)
266 0 0 if ($lint->errors)
272 0 0 if ($logger) { }
283 0 0 if (defined $headers and $headers =~ /^Status: (\d+)/mu) { }
0 0 elsif ($info) { }
291 0 0 if ($logger)
298 0 0 if ($ENV{'SERVER_PROTOCOL'} and $ENV{'SERVER_PROTOCOL'} eq 'HTTP/1.1' || $ENV{'SERVER_PROTOCOL'} eq 'HTTP/2.0' and $generate_etag and defined $body)
305 0 0 if ($ENV{'HTTP_IF_NONE_MATCH'} and $generate_304 and $status == 200)
306 0 0 if ($logger)
309 0 0 if ($ENV{'HTTP_IF_NONE_MATCH'} eq $etag) { }
0 0 elsif ($logger) { }
313 0 0 if ($logger)
325 0 0 if (defined $unzipped_body)
326 0 0 $ENV{'Range'} ? :
328 0 0 if ($range and not $cache)
330 0 0 if ($range =~ /^bytes=(\d*)-(\d*)/u)
331 0 0 if ($1 and $2) { }
0 0 elsif ($1) { }
0 0 elsif ($2) { }
345 0 0 if ($cache) { }
0 0 elsif ($info) { }
352 0 0 if (not defined $body) { }
353 0 0 if ($send_body)
355 0 0 if (defined $cobject) { }
0 0 elsif ($logger) { }
360 0 0 if ($info) { }
377 0 0 if ($send_body and $ENV{'SERVER_PROTOCOL'} and $ENV{'SERVER_PROTOCOL'} eq 'HTTP/1.1' || $ENV{'SERVER_PROTOCOL'} eq 'HTTP/2.0' and $generate_304 and $status == 200)
380 0 0 if ($ENV{'HTTP_IF_MODIFIED_SINCE'})
387 0 0 if ($send_body and $status == 200 and defined $cache_hash)
389 0 0 unless (defined $body)
398 0 0 if ($logger) { }
409 0 0 if ($send_body and $ENV{'SERVER_PROTOCOL'} and $ENV{'SERVER_PROTOCOL'} eq 'HTTP/1.1' || $ENV{'SERVER_PROTOCOL'} eq 'HTTP/2.0' and $status == 200)
412 0 0 if ($ENV{'HTTP_IF_NONE_MATCH'})
413 0 0 unless (defined $etag)
414 0 0 unless ($encode_loaded)
420 0 0 if ($logger and $generate_304)
423 0 0 if ($ENV{'HTTP_IF_NONE_MATCH'} eq $etag and $generate_304)
427 0 0 if ($logger)
433 0 0 if ($status == 200)
435 0 0 if ($send_body)
436 0 0 if ($generate_etag and not defined $etag and defined $body and not defined $headers && $headers =~ /^ETag: /mu)
443 0 0 unless ($etag)
444 0 0 if (defined $headers and $headers =~ /^ETag: "([a-z0-9]{32})"/mu) { }
450 0 0 if ($ENV{'HTTP_IF_NONE_MATCH'} and $send_body and $status != 304 and $generate_304)
451 0 0 if ($logger)
454 0 0 if (defined $etag and $etag eq $ENV{'HTTP_IF_NONE_MATCH'} and $status == 200) { }
458 0 0 if ($logger)
465 0 0 if ($cobject)
466 0 0 if ($ENV{'HTTP_IF_MODIFIED_SINCE'} and $status != 304 and not $cannot_304)
472 0 0 if ($status == 200 and $generate_last_modified)
473 0 0 if ($logger)
481 0 0 if ($status == 200)
482 0 0 unless ($cache_age)
489 0 0 if (@o and defined $o[0]) { }
0 0 elsif (defined $headers and length $headers) { }
493 0 0 if (defined $headers and length $headers) { }
501 0 0 if (length $c)
508 0 0 if (length $headers)
512 0 0 if ($generate_etag and defined $etag)
518 0 0 if ($logger)
522 0 0 if ($generate_last_modified)
524 0 0 if (defined $cobject) { }
531 0 0 if ($info) { }
533 0 0 if (defined $x_cache) { }
540 0 0 if (defined $x_cache) { }
555 0 0 if ($generate_last_modified)
556 0 0 if (my $age = _my_age())
560 0 0 if ($ENV{'HTTP_IF_MODIFIED_SINCE'} and $status != 304 and $generate_304)
569 0 0 if ($generate_etag and not defined $headers && $headers =~ /^ETag: /mu)
570 0 0 if (defined $etag) { }
0 0 elsif ($logger and $status == 200 || $status == 304 and $body and not is_cached()) { }
572 0 0 if ($logger)
581 0 0 if (defined $body) { }
582 0 0 if (utf8::is_utf8($body))
590 0 0 if (defined $headers and length $headers) { }
594 0 0 if ($body and $send_body)
595 0 0 if (scalar grep(/^Content-Length: \d/u, @o) == 0)
599 0 0 if (scalar grep(/^Status: \d/u, @o) == 0)
609 0 0 if ($body_length and $send_body)
614 0 0 if (do {
649 0 0 if (not $send_body && defined $body)
655 0 0 if ($logger)
659 0 0 unless ($generate_304)
664 0 0 unless (defined $params->{'since'})
668 0 0 unless (defined $s)
674 0 0 unless (defined $age)
677 0 0 if ($age > $s)
678 0 0 if ($logger)
685 0 0 if ($logger)
688 0 0 if ($params->{'modified'} <= $s)
692 0 0 if ($logger)
755 0 0 if ($cache_key)
758 0 0 unless (defined $info)
763 0 0 if ($lingua)
766 0 0 if ($ENV{'HTTP_COOKIE'})
771 0 0 unless ($cookie =~ /^__utm[abcz]/u)
778 0 0 if ($headers and $headers =~ /^Vary: .*$/mu)
779 0 0 if (defined $logger)
784 0 0 if (lc $h1_name eq "vary")
787 0 0 if ($h2_name eq $h1_value)
798 0 0 if (defined $logger)
860 0 0 ref $_[0] eq 'HASH' ? :
863 0 0 if (defined $params{'generate_etag'})
866 0 0 if (defined $params{'generate_last_modified'})
869 0 0 if (defined $params{'compress_content'})
872 0 0 if (defined $params{'optimise_content'})
875 0 0 if (defined $params{'lint_content'})
878 0 0 if (defined $params{'logger'})
881 0 0 if (defined $params{'lingua'})
884 0 0 if (defined $params{'generate_304'})
887 0 0 if (defined $params{'info'} and not defined $info)
893 0 0 if ($pos > 0)
894 0 0 if (defined $logger) { }
902 0 0 if (defined $params{'cache'} and can_cache())
903 0 0 if (defined $ENV{'HTTP_CACHE_CONTROL'})
905 0 0 if (defined $logger)
908 0 0 if ($control =~ /^max-age\s*=\s*(\d+)$/u)
912 0 0 if (defined $logger)
919 0 0 if (not defined $params{'cache'} and defined $cache) { }
920 0 0 if (defined $logger)
921 0 0 if ($cache_key) { }
931 0 0 if (defined $params{'cache_key'})
941 6 0 unless @_
953 0 0 ref $_[0] eq 'HASH' ? :
965 0 3 if (defined $x_cache)
969 0 3 if (defined $ENV{'NO_CACHE'} or defined $ENV{'NO_STORE'})
973 0 3 if (defined $ENV{'HTTP_CACHE_CONTROL'})
975 0 0 if (defined $logger)
979 0 0 if ($control eq "no-store" or $control eq "no-cache" or $control eq "max-age=0" or $control eq "private")
1030 9 0 unless ($cache)
1031 0 9 if ($logger)
1039 0 0 if ($logger)
1043 0 0 unless ($cobject)
1044 0 0 if ($logger)
1049 0 0 unless ($cobject->value($key))
1050 0 0 if ($logger)
1060 0 0 unless (defined $age)
1061 0 0 if ($logger)
1069 0 0 if ($age > $cobject->created_at)
1071 0 0 if ($logger)
1081 0 0 if ($logger)
1088 0 0 if ($script_mtime)
1091 0 0 unless (defined $info)
1092 0 0 if ($cache) { }
1100 0 0 unless (defined $path)
1111 0 0 if ($compress_content and $ENV{'HTTP_ACCEPT_ENCODING'} || $ENV{'HTTP_TE'})
1112 0 0 if (scalar @content_type)
1113 0 0 if ($content_type[0] ne "text")
1117 0 0 $ENV{'HTTP_ACCEPT_ENCODING'} ? :
1119 0 0 if ($method eq "gzip" or $method eq "x-gzip" or $method eq "br")
1134 0 0 if (lc $header_name eq "content-type")
1142 0 0 ref $_[0] eq 'HASH' ? :
1144 0 0 unless defined $body
1148 0 0 if (length $encoding == 0 or length $body < 32)
1152 0 0 if ($encoding eq 'gzip') { }
0 0 elsif ($encoding eq 'br') { }
1157 0 0 unless ($encode_loaded)
1162 0 0 if (length $nbody < length $body)
1172 0 0 unless ($encode_loaded)
1177 0 0 if (length $nbody < length $body)