Branch Coverage

blib/lib/CGI/Buffer.pm
Criterion Covered Total %
branch 12 366 3.2


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)
141 0 0 if ($ENV{'REQUEST_METHOD'} and $ENV{'REQUEST_METHOD'} eq 'HEAD') { }
147 0 0 if ($headers)
151 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) { }
155 0 0 if ($cache)
160 0 0 if ($optimise_content)
164 0 0 if ($logger)
171 0 0 if ($optimise_content == 1) { }
177 0 0 if $newlength >= $oldlength
186 0 0 unless (defined $info)
187 0 0 if ($cache) { }
197 0 0 unless ($protocol)
226 0 0 if ($optimise_content >= 2)
233 0 0 if ($optimise_content >= 2)
239 0 0 if $newlength >= $oldlength
244 0 0 if ($lint_content)
248 0 0 if ($logger)
255 0 0 if ($lint->errors)
261 0 0 if ($logger) { }
272 0 0 if (defined $headers and $headers =~ /^Status: (\d+)/mu) { }
0 0 elsif ($info) { }
280 0 0 if ($logger)
287 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)
294 0 0 if ($ENV{'HTTP_IF_NONE_MATCH'} and $generate_304 and $status == 200)
295 0 0 if ($logger)
298 0 0 if ($ENV{'HTTP_IF_NONE_MATCH'} eq $etag) { }
0 0 elsif ($logger) { }
302 0 0 if ($logger)
314 0 0 if (defined $unzipped_body)
315 0 0 $ENV{'Range'} ? :
317 0 0 if ($range and not $cache)
319 0 0 if ($range =~ /^bytes=(\d*)-(\d*)/u)
320 0 0 if ($1 and $2) { }
0 0 elsif ($1) { }
0 0 elsif ($2) { }
334 0 0 if ($cache) { }
0 0 elsif ($info) { }
341 0 0 if (not defined $body) { }
342 0 0 if ($send_body)
344 0 0 if (defined $cobject) { }
0 0 elsif ($logger) { }
349 0 0 if ($info) { }
366 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)
369 0 0 if ($ENV{'HTTP_IF_MODIFIED_SINCE'})
376 0 0 if ($send_body and $status == 200 and defined $cache_hash)
378 0 0 unless (defined $body)
387 0 0 if ($logger) { }
398 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)
401 0 0 if ($ENV{'HTTP_IF_NONE_MATCH'})
402 0 0 unless (defined $etag)
403 0 0 unless ($encode_loaded)
409 0 0 if ($logger and $generate_304)
412 0 0 if ($ENV{'HTTP_IF_NONE_MATCH'} eq $etag and $generate_304)
416 0 0 if ($logger)
422 0 0 if ($status == 200)
424 0 0 if ($send_body)
425 0 0 if ($generate_etag and not defined $etag and not defined $headers && $headers =~ /^ETag: /mu)
432 0 0 unless ($etag)
433 0 0 if (defined $headers and $headers =~ /^ETag: "([a-z0-9]{32})"/mu) { }
439 0 0 if ($ENV{'HTTP_IF_NONE_MATCH'} and $send_body and $status != 304 and $generate_304)
440 0 0 if ($logger)
443 0 0 if (defined $etag and $etag eq $ENV{'HTTP_IF_NONE_MATCH'} and $status == 200) { }
447 0 0 if ($logger)
454 0 0 if ($cobject)
455 0 0 if ($ENV{'HTTP_IF_MODIFIED_SINCE'} and $status != 304 and not $cannot_304)
461 0 0 if ($status == 200 and $generate_last_modified)
462 0 0 if ($logger)
470 0 0 if ($status == 200)
471 0 0 unless ($cache_age)
478 0 0 if (@o and defined $o[0]) { }
0 0 elsif (defined $headers and length $headers) { }
482 0 0 if (defined $headers and length $headers) { }
490 0 0 if (length $c)
497 0 0 if (length $headers)
501 0 0 if ($generate_etag and defined $etag)
507 0 0 if ($logger)
511 0 0 if ($generate_last_modified)
513 0 0 if (defined $cobject) { }
520 0 0 if ($info) { }
522 0 0 if (defined $x_cache) { }
529 0 0 if (defined $x_cache) { }
544 0 0 if ($generate_last_modified)
545 0 0 if (my $age = _my_age())
549 0 0 if ($ENV{'HTTP_IF_MODIFIED_SINCE'} and $status != 304 and $generate_304)
558 0 0 if ($generate_etag and not defined $headers && $headers =~ /^ETag: /mu)
559 0 0 if (defined $etag) { }
0 0 elsif ($logger and $status == 200 || $status == 304 and $body and not is_cached()) { }
561 0 0 if ($logger)
570 0 0 if (defined $body) { }
571 0 0 if (utf8::is_utf8($body))
579 0 0 if (defined $headers and length $headers) { }
583 0 0 if ($body and $send_body)
584 0 0 if (scalar grep(/^Content-Length: \d/u, @o) == 0)
588 0 0 if (scalar grep(/^Status: \d/u, @o) == 0)
598 0 0 if ($body_length and $send_body)
603 0 0 if (do {
638 0 0 if (not $send_body && defined $body)
644 0 0 if ($logger)
648 0 0 unless ($generate_304)
653 0 0 unless (defined $params->{'since'})
657 0 0 unless (defined $s)
663 0 0 unless (defined $age)
666 0 0 if ($age > $s)
667 0 0 if ($logger)
674 0 0 if ($logger)
677 0 0 if ($params->{'modified'} <= $s)
681 0 0 if ($logger)
744 0 0 if ($cache_key)
747 0 0 unless (defined $info)
752 0 0 if ($lingua)
755 0 0 if ($ENV{'HTTP_COOKIE'})
760 0 0 unless ($cookie =~ /^__utm[abcz]/u)
767 0 0 if ($headers and $headers =~ /^Vary: .*$/mu)
768 0 0 if (defined $logger)
773 0 0 if (lc $h1_name eq "vary")
776 0 0 if ($h2_name eq $h1_value)
787 0 0 if (defined $logger)
849 0 0 ref $_[0] eq 'HASH' ? :
852 0 0 if (defined $params{'generate_etag'})
855 0 0 if (defined $params{'generate_last_modified'})
858 0 0 if (defined $params{'compress_content'})
861 0 0 if (defined $params{'optimise_content'})
864 0 0 if (defined $params{'lint_content'})
867 0 0 if (defined $params{'logger'})
870 0 0 if (defined $params{'lingua'})
873 0 0 if (defined $params{'generate_304'})
876 0 0 if (defined $params{'info'} and not defined $info)
882 0 0 if ($pos > 0)
883 0 0 if (defined $logger) { }
891 0 0 if (defined $params{'cache'} and can_cache())
892 0 0 if (defined $ENV{'HTTP_CACHE_CONTROL'})
894 0 0 if (defined $logger)
897 0 0 if ($control =~ /^max-age\s*=\s*(\d+)$/u)
901 0 0 if (defined $logger)
908 0 0 if (not defined $params{'cache'} and defined $cache) { }
909 0 0 if (defined $logger)
910 0 0 if ($cache_key) { }
920 0 0 if (defined $params{'cache_key'})
930 6 0 unless @_
942 0 0 ref $_[0] eq 'HASH' ? :
954 0 3 if (defined $x_cache)
958 0 3 if (defined $ENV{'NO_CACHE'} or defined $ENV{'NO_STORE'})
962 0 3 if (defined $ENV{'HTTP_CACHE_CONTROL'})
964 0 0 if (defined $logger)
968 0 0 if ($control eq "no-store" or $control eq "no-cache" or $control eq "max-age=0" or $control eq "private")
1019 9 0 unless ($cache)
1020 0 9 if ($logger)
1028 0 0 if ($logger)
1032 0 0 unless ($cobject)
1033 0 0 if ($logger)
1038 0 0 unless ($cobject->value($key))
1039 0 0 if ($logger)
1049 0 0 unless (defined $age)
1050 0 0 if ($logger)
1058 0 0 if ($age > $cobject->created_at)
1060 0 0 if ($logger)
1070 0 0 if ($logger)
1077 0 0 if ($script_mtime)
1080 0 0 unless (defined $info)
1081 0 0 if ($cache) { }
1089 0 0 unless (defined $path)
1100 0 0 if ($compress_content and $ENV{'HTTP_ACCEPT_ENCODING'} || $ENV{'HTTP_TE'})
1101 0 0 if (scalar @content_type)
1102 0 0 if ($content_type[0] ne "text")
1106 0 0 $ENV{'HTTP_ACCEPT_ENCODING'} ? :
1108 0 0 if ($method eq "gzip" or $method eq "x-gzip" or $method eq "br")
1123 0 0 if (lc $header_name eq "content-type")
1131 0 0 ref $_[0] eq 'HASH' ? :
1135 0 0 if (length $encoding == 0 or length $body < 32)
1139 0 0 if ($encoding eq 'gzip') { }
0 0 elsif ($encoding eq 'br') { }
1144 0 0 unless ($encode_loaded)
1149 0 0 if (length $nbody < length $body)
1159 0 0 unless ($encode_loaded)
1164 0 0 if (length $nbody < length $body)