Branch Coverage

lib/MojoX/HTTP/Async.pm
Criterion Covered Total %
branch 101 164 61.5


line true false branch
94 0 26 $^O eq 'MSWin32' ? :
26 0 $^O ne 'MSWin32' ? :
186 0 5 unless $opts{'host'}
191 1 4 $opts{'ssl'} ? :
207 0 19 if $self->{'debug'}
209 0 19 unless socket my $socket, 2, 1, $proto
210 0 19 unless connect $socket, $peer_addr
215 19 0 if (&IS_NOT_WIN)
216 0 19 unless fcntl $socket, 4, 2049
219 0 19 if (&IS_WIN)
221 0 0 unless defined $socket->blocking(0)
227 17 2 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 2 17 if ($self->{'ssl'})
253 0 2 unless $ssl_socket
262 19 0 if ($timeout > 0) { }
274 0 19 if ($error)
275 0 0 if $error ne "alarm\n"
286 0 14 unless $host_addr
299 14 0 if $slot
323 98892 0 unless ($message)
324 0 98892 $!{'EPIPE'} || $!{'ECONNRESET'} || $!{'ECONNREFUSED'} || $!{'ECONNABORTED'} ? :
328 0 126506 if (vec($error_handles, $slot_no, 1) != 0)
339 24 0 if not $_->{'is_busy'} and $_->{'socket'}
342 19 16 if (%socks2slots)
354 19 0 if ($nfound)
414 13 9 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 14 12 if ($force)
441 14 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 6 if $slot->{'tx'} or not $slot->{'is_busy'}
572 0 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 57590 0 unless $slot->{'is_busy'} or $slot->{'tx'}
612 98861 8 $not_empty ? :
639 12 0 $timeout ? :
642 0 90871 if $exp_ts and &MojoX::HTTP::Async::time() >= $exp_ts
643 12 90859 if $response = $self->next_response or not $self->not_empty
644 90859 0 unless $response
666 0 98861 if ($slot)
678 184058 6 if not $_->{'tx'} || $_->{'reconnect_is_required'}
681 98868 5 if (%socks2slots)
695 6 126468 if ($nfound and vec($read_handles, $sock_no, 1) == 1) { }
697 0 6 unless $slot->{'tx'}
698 0 6 unless $slot->{'is_busy'}
701 6 126462 if (not $slot->{'tx'} and ($slot->{'exp_ts'} and &MojoX::HTTP::Async::time() > $slot->{'exp_ts'}))
707 12 126462 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