Branch Coverage

blib/lib/Net/HTTP/Methods.pm
Criterion Covered Total %
branch 130 220 59.0


line true false branch
11 0 20 unless (utf8::downgrade($_[0], 1))
25 1 4 if @_ == 1
35 0 8 if $cnf->{'Listen'}
41 12 2 if not defined $cnf->{$key} or "" eq $cnf->{$key}
45 6 2 unless (defined $peer)
46 0 6 unless $host
62 7 1 if ($host or not $explicit_host)
63 6 1 $explicit_host ? :
64 6 1 unless ($uri->_port)
70 5 2 if (substr($host_port, 0 - length($remove)) eq $remove)
80 8 0 unless defined $http_version
82 6 2 unless defined $peer_http_version
85 6 2 unless defined $max_line_length
87 8 0 unless defined $max_header_lines
89 1 7 unless $self->http_connect($cnf)
115 43 42 if @_
124 8 0 if (@_)
126 0 8 if $v eq 1
127 0 8 unless ($v eq "1.0" or $v eq "1.1")
141 0 20 @_ % 2 ? :
145 0 40 if /\s/ or not length $_
158 0 12 if ($lc_k eq "connection")
164 0 12 if (exists $given{$lc_k})
170 0 20 if (length $content and not $given{'content-length'})
175 0 20 if ($given{'te'}) { }
0 40 elsif ($self->send_te and gunzip_ok()) { }
176 0 0 unless grep((lc $_ eq "te"), @connection)
185 20 0 unless (grep((lc $_ eq "close"), @connection))
186 12 8 if ($self->keep_alive) { }
187 4 8 if ($peer_ver eq "1.0")
194 6 2 if $ver ge "1.1"
197 10 10 if @connection
198 20 0 unless ($given{'host'})
200 18 2 if $h
214 0 0 unless defined $_[0] and length $_[0]
220 0 0 unless defined $_[0] and length $_[0]
240 0 1280 if @_ > 3
244 62 1218 if (length $_) { }
249 0 1218 unless $self->can_read
265 153 481 if $pos >= 0
266 0 481 if $max_line_length and length $_ > $max_line_length
274 0 481 unless $self->can_read
279 481 0 if (defined $bytes_read) { }
0 0 elsif ($!{'EINTR'} or $!{'EAGAIN'} or $!{'EWOULDBLOCK'}) { }
288 0 0 unless length $_
292 0 0 length $_ ? :
0 481 if $new_bytes == 0
296 0 153 if $max_line_length and $pos > $max_line_length
300 0 153 unless $line =~ s/(\015?\012)\z//
301 20 133 wantarray ? :
308 500 1196 unless defined fileno $self
309 832 364 if $self->isa("IO::Socket::SSL") and $self->pending
310 0 0 if $self->isa("Net::SSL") and $self->can("pending") and $self->pending
314 0 364 @_ ? :
321 364 0 if $timeout
323 0 364 if ($nfound < 0)
324 0 0 if ($!{'EINTR'} or $!{'EAGAIN'} or $!{'EWOULDBLOCK'})
326 0 0 if ($timeout)
328 0 0 if $timeout < 0
341 0 0 if (@_) { }
344 0 0 if defined wantarray
368 90 2 if ($line =~ /^(\S+?)\s*:\s*(.*)/s) { }
0 2 elsif (@headers and $line =~ s/^\s+//) { }
1 1 elsif ($junk_out) { }
380 91 0 if ($max_header_lines)
382 0 91 if ($line_count >= $max_header_lines)
396 0 20 unless (defined $status)
401 2 18 unless ($peer_ver and $peer_ver =~ s[^HTTP/][] and $code =~ /^[1-5]\d\d$/)
402 1 1 unless $laxed
407 0 1 unless wantarray
415 1 17 if ($laxed)
425 4 82 if ($h eq 'transfer-encoding') { }
12 70 elsif ($h eq 'content-length') { }
429 4 0 if length $te
433 12 0 if ($headers[$i + 1] =~ /^\s*(\d{1,15})(?:\s|$)/)
442 0 17 unless wantarray
451 0 1295 if $_[2]
456 17 1278 if (do { *$self }->{'http_first_body'}) { }
462 1 16 if ($method eq 'HEAD') { }
3 13 elsif (my $te = do { *$self }->{'http_te'}) { }
11 2 elsif (defined(my $content_length = do { *$self }->{'http_content_length'})) { }
0 2 elsif ($status =~ /^(?:1|[23]04)/) { }
468 0 3 unless pop @te eq "chunked"
473 0 0 if ($_ eq 'deflate' and inflate_ok()) { }
0 0 elsif ($_ eq 'gzip' and gunzip_ok()) { }
0 0 elsif ($_ eq 'identity') { }
476 0 0 unless $i
484 0 0 unless $_[1]
487 0 0 unless IO::Uncompress::Gunzip::gunzip(\$input, \$output, "Transparent", 0)
502 0 3 @te ? :
525 18 1277 if (defined $chunked) { }
1272 5 elsif (defined $bytes) { }
531 12 6 if ($chunked <= 0)
533 9 3 if ($chunked == 0)
534 0 9 if not defined $line or $line ne ""
538 0 12 unless defined $line
541 0 12 unless ($chunk_len =~ /^([\da-fA-F]+)\s*$/)
546 3 9 if ($chunked == 0)
551 0 3 if (my $transforms = delete do { *$self }->{'http_te2'})
568 0 15 if $size and $size < $n
570 0 15 unless defined $n
574 15 0 if ($n > 0)
575 0 15 if (my $transforms = do { *$self }->{'http_te2'})
580 0 0 if $n == 0
586 12 1260 unless ($bytes)
591 1243 17 if $size and $size < $n
593 1259 1 defined $n ? :
605 10 3 unless do { *$self }->{'http_trailers'}
613 0 0 if defined $gunzip_ok
629 0 0 if defined $inflate_ok