Branch Coverage

blib/lib/Perlbal/BackendHTTP.pm
Criterion Covered Total %
branch 87 154 56.4


line true false branch
73 0 23 unless ($sock and defined fileno $sock)
78 0 23 unless ($inet_aton)
86 23 0 unless ref $self
105 0 1 if ($self->state eq 'connecting' or $self->state eq 'verifying_backend')
140 0 0 unless socketpair $csock, $psock, 1, 1, 0
147 0 0 unless (defined $pid)
153 0 0 unless ($pid)
186 0 18 if (defined $_[0] and $_[0] eq 'EPIPE')
192 0 18 if $$self{'closed'}
198 16 2 if (my $client = $$self{'client'})
204 18 0 if (my $reportto = $$self{'reportto'})
214 254 0 unless $_[1]
236 0 135 if $$self{'client'}
252 0 135 unless ($client_ip)
263 122 13 $persist ? :
265 24 111 if ($$svc{'enable_reproxy'})
271 0 135 if ($svc->trusted_ip($client_ip)) { }
275 0 0 unless ($$svc{'blind_proxy'})
294 0 135 if $svc->run_hook('backend_client_assigned', $self)
297 135 0 if $svc
302 135 0 if (my $client = $$self{'client'})
333 0 113 if defined $NoVerify{$$self{'ipport'}} and $NoVerify{$$self{'ipport'}} < $now
337 23 90 if (not $$self{'client'} and $$self{'state'} eq 'connecting')
346 1 22 if (my $error = unpack('i', getsockopt($$self{'sock'}, 1, 4)))
351 1 21 if (defined $$self{'service'} and $$self{'service'}{'verify_backend'} and not $$self{'has_attention'} and not defined $NoVerify{$$self{'ipport'}}) { }
354 0 1 if $$self{'service'}->run_hook('backend_write_verify', $self)
372 38 52 if ($$self{'client'} and $$self{'buffered_upload_mode'})
378 49 3 if $done
401 1 0 if (defined $$self{'service'})
402 0 1 if $$self{'service'}->run_hook('backend_readable_verify', $self)
405 0 1 if ($$self{'content_length_remain'}) { }
1 0 elsif (my $hd = $self->read_response_headers) { }
410 0 0 unless defined $bref
414 0 1 unless $hd->res_keep_alive_options
420 1 0 if ($$self{'res_headers'} and not $$self{'content_length_remain'})
438 0 150 if (scalar @$ref > 500)
443 1 149 if $$self{'reportto'}->backend_response_received($self)
456 0 149 if ($te and not $te =~ /\bidentity\b/i)
465 2 147 if ($rqhd->request_method eq 'HEAD') { }
475 6 143 if (my $rep = $hd->header('X-REPROXY-FILE') and $self->may_reproxy) { }
13 130 elsif (my $urls = $hd->header('X-REPROXY-URL') and $self->may_reproxy) { }
0 130 elsif (my $svcname = $hd->header('X-REPROXY-SERVICE') and $self->may_reproxy) { }
0 131 elsif ($res_code == 500 and $rqhd->request_method =~ /^GET|HEAD$/ and $client->should_retry_after_500($self)) { }
482 2 11 if $reproxy_cache_for
510 15 115 if ($$client{'primary_res_hdrs'})
519 0 15 if ($rescode == 206 or $rescode == 416)
521 0 0 if $hd->header('Accept-Ranges')
522 0 0 if $hd->header('Content-Range')
524 8 7 if $thd->response_code == 204
531 115 15 ref $$self{'service'} eq 'Perlbal::Service' ? :
543 2 128 if (defined $$self{'content_length'} and not $$self{'content_length_remain'})
557 0 19 unless $svc
566 1 279 if $$self{'waiting_options'}
575 0 279 unless $client
577 150 129 unless ($$self{'res_headers'})
578 0 150 unless $self->read_response_headers
583 0 129 if ($client->too_far_behind_backend)
591 129 0 if (defined $bref) { }
597 129 0 if ($$self{'content_length'})
599 128 1 unless ($$self{'content_length_remain'})
626 0 150 if $$self{'closed'}
631 149 1 unless $initial
638 15 135 unless $hd->res_keep_alive($$self{'req_headers'}, $initial)
642 0 135 if $$self{'pool'} and not $$self{'pool'}->backend_should_live($self)
646 134 1 unless $initial
649 135 0 if (my $svc = $$self{'service'})
653 0 135 if ($$svc{'max_backend_uses'} and $$self{'use_count'} > $$svc{'max_backend_uses'})
661 15 120 if (($hd->header('Keep-Alive') || '') =~ /\btimeout=(\d+)/i) { }
696 0 1 if ($$self{'client'})
706 1 0 if ($$self{'state'} eq 'connecting' or $$self{'state'} eq 'verifying_backend')
728 0 0 $$self{'sock'} ? :
729 0 0 $name ? :
730 0 0 if $lport
731 0 0 if (my $cp = $$self{'client'})
735 0 0 if (defined $$self{'service'} and $$self{'service'}{'verify_backend'})
737 0 0 $$self{'has_attention'} ? :
746 0 0 if $self->state eq 'bored'