Branch Coverage

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


line true false branch
58 500 930 if exists $params{$_}
61 100 186 if (my $on_closed = $params{'on_closed'})
74 0 286 unless defined $self->{'max_in_flight'}
94 0 100 unless defined wantarray
108 21 186 unless my $queue = $self->{'ready_queue'}
110 79 107 if ($self->should_pipeline) { }
99 8 elsif (@$queue and $self->is_idle) { }
115 1 17 if $f->is_cancelled
117 1 16 if $ready->connecting
127 0 99 if $f->is_cancelled
129 10 89 if $ready->connecting
136 8 0 $self->is_idle ? :
153 1 215 if $head->is_done
155 3 212 if $head->stall_timer
159 100 114 if (defined $ret)
160 31 69 unless ref $ret
166 0 114 unless $head->is_done
169 2 112 if not $closed and length $$buffref
174 30 1 if $closed or not length $$buffref
192 6 28 unless $head->is_done or $head->f->is_ready
201 0 129 unless my $on_header = $args{'on_header'}
204 0 129 unless ref $req and $req->isa('HTTP::Request')
213 9 116 if ($method eq 'POST' or $method eq 'PUT' or length $req->content)
217 1 128 if ($expect_continue)
221 2 127 if ($self->{'decode_content'})
238 4 125 if ($args{'stall_timeout'})
247 4 0 if $stall_timer
266 5 124 if ($stall_timer or $args{'on_body_write'})
270 0 10 if $stall_timer
271 10 0 if $inner_on_body_write
280 4 125 defined $request_body ? :
288 0 129 if ($method eq 'CONNECT') { }
293 1 128 if ($self->{'is_proxy'}) { }
298 1 127 unless $path =~ m[^/]
301 2 127 if (defined $authority and my($user, $pass, $host) = $authority =~ /^(.*?):(.*)@(.*)$/) { }
319 4 125 if $stall_timer
320 4 125 if $stall_timer
322 4 125 $stall_timer ? :
328 8 121 if length $req->content
330 3 126 if $write_request_body and not $expect_continue
333 0 3 unless $stall_timer
336 4 125 if $stall_timer
341 1 128 $expect_continue ? :
359 2 119 if ($stall_timer)
364 1 120 if (length $$buffref >= 4 and not $$buffref =~ /^HTTP/)
366 1 0 unless $f->is_cancelled
370 3 118 unless ($$buffref =~ s/^(.*?$CRLF$CRLF)//s)
371 1 2 if ($closed)
373 1 0 unless $f->is_cancelled
394 115 3 if @headers
398 111 7 if ($protocol =~ m[^HTTP/1\.(\d+)$] and $1 >= 1)
402 1 117 if ($header->code =~ /^1/)
404 1 0 if $write_request_body
409 6 111 if $previous_response
420 2 115 if ($content_encoding and $decoder = 'Net::Async::HTTP'->can_decode($content_encoding))
429 21 96 if ($connection_close) { }
96 0 elsif (defined(my $keep_alive = lc($header->header('Keep-Alive') || ''))) { }
434 0 96 if $max and $max < $self->{'max_in_flight'}
440 0 81 if ($decoder and not eval { do { $chunk = &$decoder($chunk); 1 } })
459 21 94 if $connection_close
462 0 115 if ($decoder and not eval { do { $final = &$decoder(); 1 } })
469 0 115 if defined $final and length $final
472 115 0 unless $f->is_cancelled
113 2 eval { do { $f->done($response) unless $f->is_cancelled; 1 } } ? :
474 115 0 if $ctx->on_done
480 2 113 if (defined $e)
491 1 114 if ($req->method eq 'HEAD' or $code =~ /^1..$/ or $code eq '204' or $code eq '304')
499 4 110 if (defined $transfer_encoding and $transfer_encoding eq 'chunked') { }
99 11 elsif (defined $content_length) { }
502 0 4 if $stall_timer
508 48 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