Branch Coverage

blib/lib/Net/Async/HTTP/Connection.pm
Criterion Covered Total %
branch 141 184 76.6


line true false branch
58 490 910 if exists $params{$_}
61 98 182 if (my $on_closed = $params{'on_closed'})
74 0 280 unless defined $self->{'max_in_flight'}
94 0 98 unless defined wantarray
108 21 182 unless my $queue = $self->{'ready_queue'}
110 77 105 if ($self->should_pipeline) { }
97 8 elsif (@$queue and $self->is_idle) { }
115 1 17 if $f->is_cancelled
117 1 16 if $ready->connecting
127 0 97 if $f->is_cancelled
129 10 87 if $ready->connecting
136 8 0 $self->is_idle ? :
153 1 213 if $head->is_done
155 3 210 if $head->stall_timer
159 100 112 if (defined $ret)
160 31 69 unless ref $ret
166 0 112 unless $head->is_done
169 2 110 if not $closed and length $$buffref
174 28 1 if $closed or not length $$buffref
192 6 28 unless $head->is_done or $head->f->is_ready
201 0 127 unless my $on_header = $args{'on_header'}
204 0 127 unless ref $req and $req->isa('HTTP::Request')
213 7 116 if ($method eq 'POST' or $method eq 'PUT' or length $req->content)
217 1 126 if ($expect_continue)
221 2 125 if ($self->{'decode_content'})
238 4 123 if ($args{'stall_timeout'})
247 4 0 if $stall_timer
266 5 122 if ($stall_timer or $args{'on_body_write'})
270 0 10 if $stall_timer
271 10 0 if $inner_on_body_write
280 4 123 defined $request_body ? :
288 0 127 if ($method eq 'CONNECT') { }
293 1 126 if ($self->{'is_proxy'}) { }
298 1 125 unless $path =~ m[^/]
301 2 125 if (defined $authority and my($user, $pass, $host) = $authority =~ /^(.*?):(.*)@(.*)$/) { }
319 4 123 if $stall_timer
320 4 123 if $stall_timer
322 4 123 $stall_timer ? :
328 6 121 if length $req->content
330 3 124 if $write_request_body and not $expect_continue
333 0 3 unless $stall_timer
336 4 123 if $stall_timer
341 1 126 $expect_continue ? :
359 2 117 if ($stall_timer)
364 1 118 if (length $$buffref >= 4 and not $$buffref =~ /^HTTP/)
366 1 0 unless $f->is_cancelled
370 3 116 unless ($$buffref =~ s/^(.*?$CRLF$CRLF)//s)
371 1 2 if ($closed)
373 1 0 unless $f->is_cancelled
394 113 3 if @headers
398 109 7 if ($protocol =~ m[^HTTP/1\.(\d+)$] and $1 >= 1)
402 1 115 if ($header->code =~ /^1/)
404 1 0 if $write_request_body
409 6 109 if $previous_response
420 2 113 if ($content_encoding and $decoder = 'Net::Async::HTTP'->can_decode($content_encoding))
429 21 94 if ($connection_close) { }
94 0 elsif (defined(my $keep_alive = lc($header->header('Keep-Alive') || ''))) { }
434 0 94 if $max and $max < $self->{'max_in_flight'}
440 0 81 if ($decoder and not eval { do { $chunk = &$decoder($chunk); 1 } })
459 21 92 if $connection_close
462 0 113 if ($decoder and not eval { do { $final = &$decoder(); 1 } })
469 0 113 if defined $final and length $final
472 113 0 unless $f->is_cancelled
111 2 eval { do { $f->done($response) unless $f->is_cancelled; 1 } } ? :
474 113 0 if $ctx->on_done
480 2 111 if (defined $e)
491 1 112 if ($req->method eq 'HEAD' or $code =~ /^1..$/ or $code eq '204' or $code eq '304')
499 4 108 if (defined $transfer_encoding and $transfer_encoding eq 'chunked') { }
97 11 elsif (defined $content_length) { }
502 0 4 if $stall_timer
508 46 51 if ($content_length == 0)
513 1 50 if $stall_timer
519 0 11 if $stall_timer
538 10 6 if (not defined $chunk_length and $$buffref =~ s/^(.*?)$CRLF//)
543 1 9 unless ($header =~ s/^([A-Fa-f0-9]+).*//)
544 1 0 unless $f->is_cancelled
550 6 3 if $chunk_length
556 6 0 if (defined $chunk_length and length $$buffref >= $chunk_length + 2)
561 0 6 unless ($$buffref =~ s/^$CRLF//)
563 0 0 unless $f->is_cancelled
574 0 0 if ($closed)
576 0 0 unless $f->is_cancelled
595 0 3 if ($closed)
597 0 0 unless $f->is_cancelled
600 0 3 unless $$buffref =~ s/^(.*)$CRLF//
604 0 3 if length $1
629 0 52 unless &$on_more($content)
631 50 2 if ($content_length == 0)
636 0 2 if ($closed)
638 0 0 unless $f->is_cancelled
656 0 23 unless &$on_more($content)
658 12 11 unless $closed