Branch Coverage

blib/lib/Net/Server/HTTP.pm
Criterion Covered Total %
branch 68 240 28.3


line true false branch
90 1 1 if !$log || $log eq '/dev/null' and not $prop->{'access_log_function'}
91 0 1 unless $prop->{'access_log_format'}
92 0 6 $1 eq 't' ? :
0 6 $1 eq 'n' ? :
93 1 0 if (my $code = $prop->{'access_log_function'}) { }
0 0 elsif ($log eq 'STDOUT' or $log eq '/dev/stdout') { }
0 0 elsif ($log eq 'STDERR' or $log eq '/dev/stderr') { }
94 0 1 if (ref $code ne "CODE")
95 0 0 unless $self->can($code)
101 0 0 unless open my $fh, ">&", \*STDOUT
107 0 0 unless open my $fh, ">>", $log
127 2 1 if ($request_info->{'headers_sent'})
129 2 0 if ($method eq 'print') { }
0 0 elsif ($method eq 'printf') { }
0 0 elsif ($method eq 'say') { }
0 0 elsif ($method eq 'write') { }
0 0 elsif ($method eq 'syswrite') { }
140 0 0 if @_
148 2 0 if defined $len
152 0 1 if $method ne "print"
159 0 2 if ($line =~ m[^HTTP/(1.[01]) \s+ (\d+) (?: | \s+ (.+?)) \s* $ ]x) { }
1 1 elsif (not length $line) { }
0 1 elsif (not $line =~ s/^(\w+(?:-(?:\w+))*):\s*//) { }
160 0 0 if @{$headers->{'headers'};}
164 0 1 unless ($headers->{'status'} or @{$headers->{'headers'};})
169 0 1 if (my $n = length $headers->{'buffer'})
175 0 0 $line =~ /(.{0,120})/ ? :
181 0 1 if (lc $key eq "status" and $line =~ /^(\d+) (?:|\s+(.+?))$/xi)
182 0 0 unless $headers->{'status'}
194 2 0 unless ($self->{'server'}{'enable_dispatch'})
195 1 1 if "Net::Server::HTTP"->can("process_request") ne $self->can("process_request")
196 0 1 if "Net::Server::HTTP"->can("process_http_request") ne $self->can("process_http_request")
200 1 0 if (not $app or ref $app eq "ARRAY" and not @$app)
208 1 0 ref $app eq 'ARRAY' ? :
209 0 0 unless $a
210 0 0 $a =~ /^(.+?)=(.+)$/ ? :
0 0 $a =~ /^(.+?)\s+(.+)$/ ? :
0 0 ref $a eq 'CODE' ? :
0 0 ref $a eq 'HASH' ? :
0 0 ref $a eq 'ARRAY' ? :
221 0 0 if ($dispatch{$key})
231 0 1 if (@dispatch)
232 0 0 if (not $dispatch{'/'} and $first)
251 0 0 unless +(shift())->{'server'}{'default_content_type'}
275 2 0 if (ref $status eq "HASH")
281 2 0 if $headers
285 4 4 unless ($status)
286 1 3 if ($hdr->[0] eq 'Content-type') { }
0 3 elsif ($hdr->[0] eq 'Location') { }
295 0 2 if (not $body and $gen_body)
296 0 0 $msg eq '-' ? :
297 0 0 if ref $gen_body ne "ARRAY"
304 0 2 if ($status == 204 || $status == 304 || $status >= 100 && $status <= 199 and not $self->{'server'}{'allow_body_on_all_statuses'}) { }
310 0 2 unless $ct
324 0 2 if ($no_body) { }
0 4 elsif (defined $body and length $body) { }
372 0 1 if (not $ok)
384 2 0 unless +(shift())->{'script_name'}
395 0 2 if $self->{'server'}{'client'}->NS_proto =~ /SSL/
399 0 2 if $ok != 1
400 0 2 if ($has_xs_parser) { }
402 0 0 if $len == -1
403 0 0 if $len == -2
407 0 2 unless defined $req
409 0 2 unless (defined $req and $req =~ m[ ^\s*(GET|POST|PUT|PATCH|DELETE|PUSH|HEAD|OPTIONS)\s+(.+)\s+(HTTP/1\.[01])\s*$ ]xi)
415 0 2 if $ENV{'REQUEST_URI'} =~ / \?(.*)$ /x
416 2 0 if $ENV{'REQUEST_URI'} =~ /^([^\?]+)/
422 0 4 if $key eq "COOKIES"
425 4 0 unless $key =~ /^CONTENT_(?:LENGTH|TYPE)$/
427 0 4 if (exists $ENV{$key}) { }
438 2 0 if $type eq "Net::Server::MultiType"
456 0 2 if defined $ENV{'QUERY_STRING'}
457 0 2 $ENV{'HTTPS'} ? :
467 0 0 if @_ >= 3
474 0 0 unless $ENV{'PATH_INFO'} =~ s[^($dispatch_qr)(?=/|$|(?<=/))][]
476 0 0 if ($ENV{'PATH_INFO'})
477 0 0 unless $ENV{'PATH_INFO'} =~ m[^/]
481 0 0 if ref $code
488 0 1 if (my $table = $self->{'dispatch'})
489 0 0 unless my $qr = $self->{'dispatch_qr'}
499 0 1 if ($ENV{'PATH_INFO'} and $ENV{'PATH_INFO'} eq "/simple")
504 1 0 if (eval { do { require Data::Dumper } })
507 1 0 if (eval { do { require CGI } })
515 0 2 unless defined $info->{'begin'}
567 0 1 if $1 and $orig and $1 eq "<"
575 0 0 $4 eq '%' ? :
0 0 $4 eq 'D' ? :
0 0 $4 eq 'T' ? :
0 0 $4 eq 'O' ? :
0 0 $4 eq 'I' ? :
1 0 $4 eq 'b' ? :
3 1 $fmt_code{$4} ? :
5 4 $fmt_map{$4} ? :
0 9 $2 && (substr($2, 0, 1) eq '!' ? index($2, $info->{'response_status'}) != -1 : index($2, $info->{'response_status'}) == -1) ? :
578 1 8 unless defined $v and length $v
579 0 0 $1 eq "\t" ? :
0 0 $1 eq "\n" ? :
592 0 0 unless $info->{'request_headers'}
593 0 0 if $cookie =~ /^\Q$var\E=(.*)/
600 0 2 unless $info->{'request_headers'}
609 0 0 unless $info->{'response_headers'}
611 0 0 unless $_[1]{'pid'}
618 0 0 $info->{'headers_sent'} ? :
627 0 0 unless -x $file
630 0 0 unless defined $pid
632 0 0 if (not $pid) { }
633 0 0 unless (eval { do { require $file } })
636 0 0 unless $self->{'request_info'}{'headers_sent'}
653 0 0 if $pid == $chld
654 0 0 unless $chld > 0
664 0 0 unless $pid = eval { do { IPC::Open3::open3($in, $out, $err, $file) } }
667 0 0 $len ? :
674 0 0 unless read $fh, my $buf, 4096
675 0 0 if ($fh == $out) { }
682 0 0 if (@$i)
684 0 0 if $bytes
686 0 0 if $len <= 0
689 0 0 unless ($self->{'request_info'}{'headers_sent'})
690 0 0 if (not $printed) { }
0 0 elsif ($done > 0) { }