Branch Coverage

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


line true false branch
56 515 980 if exists $params{$_}
59 103 196 if (my $on_closed = $params{'on_closed'})
72 0 299 unless defined $self->{'max_in_flight'}
90 1 102 defined $args{'path'} ? :
93 0 103 unless defined wantarray
107 23 192 unless my $queue = $self->{'ready_queue'}
109 82 110 if ($self->should_pipeline) { }
102 8 elsif (@$queue and $self->is_idle) { }
114 1 18 if $f->is_cancelled
116 1 17 if $ready->connecting
126 0 102 if $f->is_cancelled
128 12 90 if $ready->connecting
135 8 0 $self->is_idle ? :
152 1 225 if $head->is_done
154 3 222 if $head->stall_timer
158 105 119 if (defined $ret)
159 33 72 unless ref $ret
165 0 119 unless $head->is_done
168 2 117 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 134 unless my $on_header = $args{'on_header'}
203 0 134 unless ref $req and $req->isa("HTTP::Request")
212 9 121 if ($method eq "POST" or $method eq "PUT" or length $req->content)
216 1 133 if ($expect_continue)
220 2 132 if ($self->{'decode_content'})
237 4 130 if ($args{'stall_timeout'})
246 4 0 if $stall_timer
265 5 129 if ($stall_timer or $args{'on_body_write'})
269 0 10 if $stall_timer
270 10 0 if $inner_on_body_write
279 4 130 defined $request_body ? :
287 0 134 if ($method eq 'CONNECT') { }
292 2 132 if ($self->{'is_proxy'}) { }
297 1 131 unless $path =~ m[^/]u
300 2 132 if (defined $authority and my($user, $pass, $host) = $authority =~ /^(.*?):(.*)@(.*)$/u) { }
318 4 130 if $stall_timer
319 4 130 if $stall_timer
321 4 130 $stall_timer ? :
327 8 126 if length $req->content
329 3 131 if $write_request_body and not $expect_continue
332 0 3 unless $stall_timer
335 4 130 if $stall_timer
340 1 133 $expect_continue ? :
358 2 124 if ($stall_timer)
363 1 125 if (length $$buffref >= 4 and not $$buffref =~ /^HTTP/u)
365 1 0 unless $f->is_cancelled
369 3 123 unless ($$buffref =~ s/^(.*?$CRLF$CRLF)//su)
370 1 2 if ($closed)
372 1 0 unless $f->is_cancelled
393 120 3 if @headers
397 116 7 if ($protocol =~ m[^HTTP/1\.(\d+)$]u and $1 >= 1)
401 1 122 if ($header->code =~ /^1/u)
403 1 0 if $write_request_body
408 7 115 if $previous_response
419 2 120 if ($content_encoding and $decoder = "Net::Async::HTTP"->can_decode($content_encoding))
428 23 99 if ($connection_close) { }
99 0 elsif (defined(my $keep_alive = lc($header->header('Keep-Alive') || ''))) { }
433 0 99 if $max and $max < $self->{'max_in_flight'}
439 0 86 if ($decoder and not eval { do { $chunk = &$decoder($chunk); 1 } })
458 23 97 if $connection_close
461 0 120 if ($decoder and not eval { do { $final = &$decoder(); 1 } })
468 0 120 if defined $final and length $final
471 120 0 unless $f->is_cancelled
118 2 eval { do { $f->done($response) unless $f->is_cancelled; 1 } } ? :
473 120 0 if $ctx->on_done
479 2 118 if (defined $e)
490 1 119 if ($req->method eq "HEAD" or $code =~ /^1..$/u or $code eq 204 or $code eq 304)
498 4 115 if (defined $transfer_encoding and $transfer_encoding eq 'chunked') { }
102 13 elsif (defined $content_length) { }
501 0 4 if $stall_timer
507 50 52 if ($content_length == 0)
512 1 51 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 53 unless &$on_more($content)
630 51 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