Branch Coverage

lib/MojoX/HTTP/Async.pm
Criterion Covered Total %
branch 102 164 62.2


line true false branch
94 0 27 $^O eq 'MSWin32' ? :
27 0 $^O ne 'MSWin32' ? :
186 0 5 unless $opts{'host'}
191 1 4 $opts{'ssl'} ? :
207 0 20 if $self->{'debug'}
209 0 20 unless socket my $socket, 2, 1, $proto
210 0 20 unless connect $socket, $peer_addr
215 20 0 if (&IS_NOT_WIN)
216 0 20 unless fcntl $socket, 4, 2049
219 0 20 if (&IS_WIN)
221 0 0 unless defined $socket->blocking(0)
227 17 3 if (exists $sol_socket_opts->{'so_keepalive'})
228 0 17 unless setsockopt $socket, 1, 9, 1
230 17 0 if ($sol_socket_opts->{'so_keepalive'})
234 8 9 if (exists $sol_tcp_opts->{'tcp_keepidle'})
235 0 8 unless setsockopt $socket, $SOL_TCP, 4, $sol_tcp_opts->{'tcp_keepidle'}
238 8 9 if (exists $sol_tcp_opts->{'tcp_keepintvl'})
239 0 8 unless setsockopt $socket, $SOL_TCP, 5, $sol_tcp_opts->{'tcp_keepintvl'}
242 8 9 if (exists $sol_tcp_opts->{'tcp_keepcnt'})
243 0 8 unless setsockopt $socket, $SOL_TCP, 6, $sol_tcp_opts->{'tcp_keepcnt'}
251 3 17 if ($self->{'ssl'})
253 0 3 unless $ssl_socket
262 20 0 if ($timeout > 0) { }
274 0 20 if ($error)
275 0 0 if $error ne "alarm\n"
286 0 15 unless $host_addr
299 15 0 if $slot
323 70497 0 unless ($message)
324 0 70497 $!{'EPIPE'} || $!{'ECONNRESET'} || $!{'ECONNREFUSED'} || $!{'ECONNABORTED'} ? :
328 0 98110 if (vec($error_handles, $slot_no, 1) != 0)
339 24 0 if not $_->{'is_busy'} and $_->{'socket'}
342 19 17 if (%socks2slots)
354 19 0 if ($nfound)
414 14 8 if (not $slot and $self->{'slots'} > scalar @{$self->{'_conns'}})
419 19 3 if ($slot)
421 18 1 if (not ref $request_or_uri or &blessed($request_or_uri) and $request_or_uri->isa("Mojo::URL"))
425 19 0 if ($request)
440 15 12 if ($force)
441 15 0 if $slot->{'socket'}
487 0 19 if $slot->{'is_busy'}
488 0 19 unless $request
489 0 19 unless $request->isa("Mojo::Message::Request")
491 2 17 $self->{'ssl'} ? :
496 0 19 if ($scheme and $required_scheme ne $scheme)
500 19 0 unless ($uri->scheme)
505 0 19 if (my $host = $uri->host)
506 0 0 if ($host ne $self->{'host'})
517 18 1 unless $h->host
518 18 1 unless $h->user_agent
522 19 0 $timeout > 0 ? :
526 2 17 if ($self->{'ssl'}) { }
539 0 17 if ($! or not defined $bytes)
546 0 17 if $sent_bytes < $msg_len
549 0 17 if ($sent_bytes < $msg_len)
556 0 19 if ($slot->{'exp_ts'} and &MojoX::HTTP::Async::time() > $slot->{'exp_ts'})
565 0 7 if $slot->{'tx'} or not $slot->{'is_busy'}
572 1 6 if ($! and not $!{'EAGAIN'} and not $!{'EWOULDBLOCK'}) { }
6 0 elsif ($response and $response->code) { }
578 6 0 if ($content->is_finished) { }
589 0 6 if $content->relaxed
592 0 0 if (not $slot->{'tx'} and ($slot->{'exp_ts'} and &MojoX::HTTP::Async::time() > $slot->{'exp_ts'}))
609 29320 0 unless $slot->{'is_busy'} or $slot->{'tx'}
612 70466 8 $not_empty ? :
639 12 0 $timeout ? :
642 0 62555 if $exp_ts and &MojoX::HTTP::Async::time() >= $exp_ts
643 12 62543 if $response = $self->next_response or not $self->not_empty
644 62543 0 unless $response
666 0 70466 if ($slot)
678 127392 6 if not $_->{'tx'} || $_->{'reconnect_is_required'}
681 70473 5 if (%socks2slots)
695 7 98069 if ($nfound and vec($read_handles, $sock_no, 1) == 1) { }
697 0 7 unless $slot->{'tx'}
698 0 7 unless $slot->{'is_busy'}
701 5 98064 if (not $slot->{'tx'} and ($slot->{'exp_ts'} and &MojoX::HTTP::Async::time() > $slot->{'exp_ts'}))
707 12 98064 if ($tx)
735 5 0 if (scalar @{$self->{'_conns'}})
752 0 9 if $self->{'debug'} and $is_outdated
754 5 4 if ($slot->{'reconnect_is_required'} or $is_outdated)
755 0 5 if $self->{'debug'}
788 0 5 if $slot->{'is_busy'}
789 5 0 if $slot->{'socket'}
791 0 5 if $in_use