Branch Coverage

blib/lib/Respite/Server.pm
Criterion Covered Total %
branch 39 352 11.0


line true false branch
13 0 0 $0 =~ m[/(\w+)$]x ? :
15 0 0 unless $_[0]{'max_request_size'}
23 5 0 ref $_[0] ? :
24 0 5 if $_ = $self->new_args
25 0 5 if $self->{'non_daemon'} or $ENV{'MOD_PERL'} and not $self->{'force_daemon'}
28 3 2 unless $self->isa("Net::Server::HTTP")
29 0 5 if $Net::Server::VERSION < "2.007"
33 5 0 unless $ENV{'NO_PRELOAD'}
46 0 15 ref $def eq 'CODE' ? :
0 15 ref $c->{$name} && exists $c->{$name}{$key} ? :
0 15 exists $$c{"${name}_$key"} ? :
45 15 exists $self->{$key} ? :
54 5 0 if (not ref $meta) { }
56 0 0 unless $meta->can("new") or eval { do { require $file } }
57 0 5 unless $meta->can("run_method")
61 0 0 if $preload
81 0 0 if (eval { do { $self->modperl_init($r); $r->subprocess_env; 1 } }) { }
93 0 0 if $modperl_init
105 0 0 unless shift()
0 0 unless $self and ref $self
114 0 0 if ($ENV{'CONTENT_TYPE'} and $ENV{'CONTENT_TYPE'} =~ /\bjson\b/) { }
115 0 0 if not $ENV{'REQUEST_METHOD'} or $ENV{'REQUEST_METHOD'} eq "GET" or $ENV{'REQUEST_METHOD'} eq "HEAD"
117 0 0 if $len > $self->max_request_size
120 0 0 $r ? :
121 0 0 if length $req == $size
122 0 0 if ($size = length $req) >= $len
124 0 0 if length $req != $len
128 0 0 unless ($req)
130 0 0 if not $self->{'no_data_uriencode'} and eval { do { require Data::URIEncode } } || grep({$_ =~ /[:.]/;} keys %$args) && throw('Failed to load Data::URIEncode', {'msg', $@})
133 0 0 if scalar keys %$args
136 0 0 unless $req =~ /^\{/
141 0 0 unless ($args)
148 0 0 $self->{'warn_on_stdout'} ? :
151 0 0 unless ($ref)
153 0 0 unless ref $ref and $ref->{'error'}
154 0 0 if $_ = $self->{'_warn_info'}
157 0 0 if ($old_out)
159 0 0 if $$out_ref
162 0 0 if (ref $ref eq "ARRAY" and @$ref == 3 and $ref->[0] =~ /^\d+$/)
163 0 0 if $self->{'is_psgi'}
170 0 0 if $ref->{'_extra_headers'}
183 0 0 unless $extra
196 0 0 $env->{'HTTP_X_FORWARDED_FOR'} ? :
198 0 0 if $disp->can("server_init")
201 0 0 unless $disp->can("server_post_request")
207 0 0 if $ok
216 0 0 $no_brand ? :
0 0 $env->{'PATH_INFO'} =~ m[^/+(.+)$] ? :
0 0 (!$no_brand || $no_brand < 0) && $env->{'PATH_INFO'} =~ m[^/+(.+)/([^/]+)$] ? :
226 0 0 if $INC{'CGI.pm'}
227 0 0 $self->{'is_psgi'} ? :
0 0 unless eval { do { $self->{'is_psgi'} ? require CGI::PSGI : require CGI } }
229 0 0 $self->{'is_psgi'} ? :
236 0 0 @v <= 1 ? :
242 0 0 unless $env->{'HTTP_COOKIE'}
244 0 0 @v <= 1 ? :
251 0 0 if $self->content_type =~ m[^(?:text/|application/json$)]
252 0 0 $self->{'extra_headers'} ? :
253 0 0 if ($self->{'is_psgi'}) { }
0 0 elsif (my $r = $self->{'apache_req'} || eval { do { 'Apache2::RequestUtil'->request if $ENV{'MOD_PERL'} } }) { }
0 0 elsif (my $c = $self->{'server'}{'client'}) { }
276 0 0 if ($ENV{'SCRIPT_FILENAME'} // "") =~ m[/nph-[^/]+($|\s)]
291 0 0 if $path_info
292 0 0 if $qs
295 0 0 if ($auth) { }
296 0 0 if $sig
297 0 0 if ($auth =~ s/^Basic \s+ (\S+)$/$1/x) { }
0 0 elsif ($auth =~ s/^Digest \s+//x) { }
0 0 elsif ($auth =~ s/^RespiteAuth \s+//x) { }
301 0 0 unless $self->allow_auth_basic($brand, $user)
305 0 0 defined $3 && length $3 ? :
315 0 0 if $allow_md5
316 0 0 $allow_md5 ? :
0 0 !($sig =~ /^[a-f0-z]{32}$/) ? :
0 0 !$sig ? :
319 0 0 ref $pass ? :
0 0 if ref $pass ne "ARRAY"
320 0 0 if $pass and not @$pass
321 0 0 if defined $exception
322 0 0 if not $sig and $type and $type ne "none"
324 0 0 if ($pass)
329 0 0 eval { do { $self->verify_digest($sig ||= {}, $pass->[$i], $uri, $req_sum, $meth, $brand, $ip) } } ? :
0 0 $type eq 'digest' ? :
0 0 $type eq 'signed' ? :
0 0 $type eq 'md5_pass' ? :
0 0 $type eq 'basic' ? :
0 0 if $type eq "basic" ? $pass->[$i] ne $sig : ($type eq "md5_pass" ? md5_hex($pass->[$i]) ne $sig : ($type eq "signed" ? do { my($_sum, $time) = split(/:/, $sig, 2); md5_hex("$pass->[$i]:${time}:${uri}:$req_sum") ne $_sum } : ($type eq "digest" ? eval { do { $self->verify_digest($sig ||= {}, $pass->[$i], $uri, $req_sum, $meth, $brand, $ip) } } ? 0 : do { $sig->{'verify'} = $@; 1 } : 1)))
331 0 0 $self->{'verify_sig_return_pass'} ? :
0 0 $type eq 'digest' ? :
334 0 0 $type eq 'digest' ? :
341 0 0 if not ref $ref or ref $ref eq "ARRAY"
342 0 0 if (exists $ref->{$ip}) { }
0 0 elsif (exists $ref->{$brand}) { }
0 0 elsif (my $c = $ref->{'~cidr~'} || $ref->{'-cidr'}) { }
343 0 0 if ref $ref->{$ip} ne "HASH"
344 0 0 if exists $ref->{$ip}{$brand}
345 0 0 if exists $ref->{$ip}{'~default~'}
346 0 0 if exists $ref->{$ip}{'-default'}
348 0 0 if ref $ref->{$brand} ne "HASH"
349 0 0 if exists $ref->{$brand}{$ip}
350 0 0 if exists $ref->{$brand}{'~default~'}
351 0 0 if exists $ref->{$brand}{'-default'}
356 0 0 if $n < $range->[0] or $n > $range->[1]
358 0 0 if (ref $ref eq "HASH")
359 0 0 if exists $ref->{$brand}
360 0 0 if exists $ref->{'~default~'}
361 0 0 if exists $ref->{'-default'}
367 0 0 if exists $ref->{'~default~'}
368 0 0 if exists $ref->{'-default'}
372 0 0 unless $_[0]
377 0 0 $name =~ /^(\w+)_server/ ? :
381 0 0 $opt ? :
0 0 unless defined $val and length $val
382 0 0 if $brand and &$d("username") ne $brand
383 0 0 if &$d("realm") ne $self->digest_realm
384 0 0 if $uri ne &$d("uri")
386 0 0 if lc &$d("algorithm", 1) eq "md5-sess"
387 0 0 $self->allow_auth_qop_auth($brand) ? :
0 0 &$d('qop', 1) eq 'auth-int' ? :
388 0 0 &$d('qop', 1) ? :
389 0 0 if $sum ne &$d("response")
400 0 5 $name =~ /^(\w+)_server/ ? :
404 0 0 $name =~ /^(\w+)_server/ ? :
0 5 if $ad and $ad eq 1
405 0 5 if defined &config::is_dev
408 0 0 $name =~ /^(\w+)_server/ ? :
0 0 $res ne 1 ? :
5 0 !$res ? :
409 0 0 unless ref $app or $app =~ m[^/]
415 0 5 ref $st ? :
0 5 ref $path ? :
0 5 $ad ? :
0 5 $ssl ? :
0 0 $port == 443 ? :
0 5 $use_dev_port ? :
0 5 $is_dev && $ssl ? :
448 0 0 unless $self->{'post_client_callbacks'}
453 0 0 $self->{'nshv'} ? :
471 0 0 $ARGV[0] && $class->can("__$ARGV[0]") ? :
472 0 0 if $sub
474 0 0 if ($ENV{'BOUND_SOCKETS'}) { }
0 0 elsif ($sub) { }
0 0 elsif ($ENV{'PLACK_ENV'}) { }
0 0 elsif (not @ARGV) { }
475 0 0 ref $class ? :
480 0 0 unless $sub =~ /^__(?:start|restart|reload)$/
481 0 0 ref $class ? :
488 0 0 ref $_[0] ? :
489 0 0 ref $class ? :
502 0 0 unless $args
509 2 1 unless -e $pid_file
510 0 1 if -z $pid_file
511 0 1 unless open my $fh, "<", $pid_file
514 1 0 $line =~ /^(\d{1,10})$/ ? :
519 3 0 $ok ? :
525 0 0 unless $pid
526 0 0 if kill 0, $pid
533 0 0 if ($pid and kill 0, $pid)
539 0 0 if (-e $pid_file)
540 0 0 unless unlink $pid_file
544 0 0 unless (Net::Server::Daemonize::safe_fork())
553 0 0 unless ($pid and kill 0, $pid)
569 2 1 if (not $pid) { }
0 1 elsif (not kill(0, $pid)) { }
575 0 1 unless (kill 15, $pid or kill 9, $pid)
580 1 9 unless kill 0, $pid
599 0 0 if (not $pid) { }
0 0 elsif (not kill(0, $pid)) { }
606 0 0 unless (kill 1, $pid)
613 0 0 if (kill 0, $pid) { }
637 0 6 if $how eq "f"
643 18 34 if $_ =~ /$name/
651 0 0 unless (eval { do { config::provider() } } or $self->_configs->{'provider'})
0 0 $self->config('no_brand', 0) ? :
656 0 0 if $INC{'CGI.pm'}
673 0 0 $name =~ /^(\w+)_server/ ? :