Branch Coverage

blib/lib/Net/Async/HTTP/Connection.pm
Criterion Covered Total %
branch 143 186 76.8


line true false branch
56 525 1010 if exists $params{$_}
59 105 202 if (my $on_closed = $params{'on_closed'})
72 0 307 unless defined $self->{'max_in_flight'}
90 1 104 defined $args{'path'} ? :
93 0 105 unless defined wantarray
107 23 196 unless my $queue = $self->{'ready_queue'}
109 84 112 if ($self->should_pipeline) { }
104 8 elsif (@$queue and $self->is_idle) { }
114 1 18 if $f->is_cancelled
116 1 17 if $ready->connecting
126 0 104 if $f->is_cancelled
128 14 90 if $ready->connecting
135 8 0 $self->is_idle ? :
152 1 229 if $head->is_done
154 3 226 if $head->stall_timer
158 107 121 if (defined $ret)
159 33 74 unless ref $ret
165 0 121 unless $head->is_done
168 2 119 if not $closed and length $$buffref
173 30 1 if $closed or not length $$buffref
191 6 30 unless $head->is_done or $head->f->is_ready
200 0 136 unless my $on_header = $args{'on_header'}
203 0 136 unless ref $req and $req->isa("HTTP::Request")
212 9 123 if ($method eq "POST" or $method eq "PUT" or length $req->content)
216 1 135 if ($expect_continue)
220 2 134 if ($self->{'decode_content'})
237 4 132 if ($args{'stall_timeout'})
246 4 0 if $stall_timer
265 5 131 if ($stall_timer or $args{'on_body_write'})
269 0 10 if $stall_timer
270 10 0 if $inner_on_body_write
279 4 132 defined $request_body ? :
287 0 136 if ($method eq 'CONNECT') { }
292 2 134 if ($self->{'is_proxy'}) { }
297 1 133 unless $path =~ m[^/]u
300 2 134 if (defined $authority and my($user, $pass, $host) = $authority =~ /^(.*?):(.*)@(.*)$/u) { }
318 4 132 if $stall_timer
319 4 132 if $stall_timer
321 4 132 $stall_timer ? :
327 8 128 if length $req->content
329 3 133 if $write_request_body and not $expect_continue
332 0 3 unless $stall_timer
335 4 132 if $stall_timer
340 1 135 $expect_continue ? :
358 2 126 if ($stall_timer)
363 1 127 if (length $$buffref >= 4 and not $$buffref =~ /^HTTP/u)
365 1 0 unless $f->is_cancelled
369 3 125 unless ($$buffref =~ s/^(.*?$CRLF$CRLF)//su)
370 1 2 if ($closed)
372 1 0 unless $f->is_cancelled
393 122 3 if @headers
397 118 7 if ($protocol =~ m[^HTTP/1\.(\d+)$]u and $1 >= 1)
401 1 124 if ($header->code =~ /^1/u)
403 1 0 if $write_request_body
408 7 117 if $previous_response
419 2 122 if ($content_encoding and $decoder = "Net::Async::HTTP"->can_decode($content_encoding))
428 23 101 if ($connection_close) { }
101 0 elsif (defined(my $keep_alive = lc($header->header('Keep-Alive') || ''))) { }
433 0 101 if $max and $max < $self->{'max_in_flight'}
439 0 88 if ($decoder and not eval {
458 23 99 if $connection_close
461 0 122 if ($decoder and not eval {
468 0 122 if defined $final and length $final
471 122 0 unless $f->is_cancelled
120 2 eval {
473 122 0 if $ctx->on_done
479 2 120 if (defined $e)
490 1 121 if ($req->method eq "HEAD" or $code =~ /^1..$/u or $code eq 204 or $code eq 304)
498 4 117 if (defined $transfer_encoding and $transfer_encoding eq 'chunked') { }
104 13 elsif (defined $content_length) { }
501 0 4 if $stall_timer
507 50 54 if ($content_length == 0)
512 1 53 if $stall_timer
518 0 13 if $stall_timer
537 10 6 if (not defined $chunk_length and $$buffref =~ s/^(.*?)$CRLF//u)
542 1 9 unless ($header =~ s/^([A-Fa-f0-9]+).*//u)
543 1 0 unless $f->is_cancelled
549 6 3 if $chunk_length
555 6 0 if (defined $chunk_length and length $$buffref >= $chunk_length + 2)
560 0 6 unless ($$buffref =~ s/^$CRLF//u)
562 0 0 unless $f->is_cancelled
573 0 0 if ($closed)
575 0 0 unless $f->is_cancelled
594 0 3 if ($closed)
596 0 0 unless $f->is_cancelled
599 0 3 unless $$buffref =~ s/^(.*)$CRLF//u
603 0 3 if length $1
628 0 55 unless &$on_more($content)
630 53 2 if ($content_length == 0)
635 0 2 if ($closed)
637 0 0 unless $f->is_cancelled
655 0 27 unless &$on_more($content)
657 14 13 unless $closed