Branch Coverage

blib/lib/LWP/Protocol/http.pm
Criterion Covered Total %
branch 65 172 37.7


line true false branch
22 0 45 if ($host =~ /:/ and not $host =~ /^\[/)
37 2 43 unless ($sock)
40 0 2 if ($@ =~ /\bconnect: (.*)/ or $@ =~ /\b(Bad hostname)\b/ or $@ =~ /\b(nodename nor servname provided, or not known)\b/ or $@ =~ /\b(certificate verify failed)\b/ or $@ =~ /\b(Crypt-SSLeay can't verify hostnames)\b/) { }
2 0 elsif ($@) { }
83 43 0 if (defined(my $peerhost = $sock->peerhost))
94 0 43 if ($hhost =~ s/^([^\@]*)\@//)
98 0 0 if (defined $1 and not $h->header('Authorization'))
106 1 42 if ($proxy and $url->scheme ne 'https')
111 0 1 if (defined $p_auth)
123 0 0 unless lc $hlist->[$i] eq $k
136 0 45 unless ($method =~ /^[A-Za-z0-9_!\#\$%&\'*+\-.^\`|~]+$/)
157 2 43 $proxy ? :
163 2 43 $proxy && !$ssl_tunnel ? :
0 45 $method eq 'CONNECT' ? :
165 0 43 unless $path =~ m[^/]
172 1 44 if ($conn_cache)
178 0 1 if $ssl_tunnel
179 0 1 if ($socket = $conn_cache->withdraw($self->socket_type, $cache_key))
180 0 0 if ($socket->can_read(0)) { }
193 0 45 if (not $socket and $ssl_tunnel)
195 0 0 unless my $proto_https = LWP::Protocol::create('https', $self->{'ua'})
200 0 0 if (my $upgrade_sub = $proto_https->can('_upgrade_sock')) { }
206 0 0 unless $response->is_success
209 0 0 unless $socket = &$upgrade_sub($proto_https, $response->{'client_socket'}, $url)
216 45 0 unless ($socket)
222 0 43 if (my $proto = $request->protocol)
223 0 0 if ($proto =~ m[^(?:HTTP/)?(1.\d+)$])
226 0 0 if $http_version eq '1.0'
244 0 43 if ref $$content_ref
248 0 43 if (ref $content_ref eq 'CODE') { }
250 0 0 if $clen
251 0 0 unless (defined $clen)
260 2 41 if (defined $$content_ref and length $$content_ref) { }
0 41 elsif ($clen) { }
262 2 0 if (not defined $clen or $clen ne $has_content)
263 0 2 if (defined $clen)
277 0 43 if ($request_headers->header('Expect') || '') =~ /100-continue/
283 0 2 if (not $has_content or $write_wait or $has_content > 8192)
289 0 41 unless (defined $n)
290 0 0 if $!{'EINTR'}
291 0 0 if ($!{'EWOULDBLOCK'} or $!{'EAGAIN'})
297 41 0 if ($n) { }
303 0 41 if length $req_buf
310 2 41 if ($has_content)
315 0 2 if ($write_wait) { }
0 2 elsif (ref $content_ref eq 'CODE') { }
324 0 0 unless defined $buf
325 0 0 if $chunked
327 0 0 if $req_buf
331 2 0 if ($req_buf) { }
348 0 2 if ($write_wait)
349 0 0 if $write_wait < $sel_timeout
352 2 0 if $sel_timeout
355 0 2 $write_wait ? :
360 0 2 if ($nfound < 0)
361 0 0 if ($!{'EINTR'} or $!{'EWOULDBLOCK'} or $!{'EAGAIN'})
362 0 0 if ($time_before)
364 0 0 if $sel_timeout < 0
372 0 2 if ($write_wait)
374 0 0 if $write_wait < 0
377 0 2 if (defined $rbits and $rbits =~ /[^\0]/)
381 0 0 defined $n ? :
382 0 0 unless $!{'EINTR'} or $!{'EWOULDBLOCK'} or $!{'EAGAIN'}
393 0 0 if (not $code and $buf =~ /\015?\012\015?\012/)
398 0 0 if ($code eq '100') { }
410 2 0 if (defined $wbits and $wbits =~ /[^\0]/)
412 2 0 defined $n ? :
413 0 0 unless $!{'EINTR'} or $!{'EWOULDBLOCK'} or $!{'EAGAIN'}
421 0 2 if (not $eof and $woffset >= length $$wbuf)
424 0 0 unless defined $buf
425 0 0 unless length $buf
426 0 0 if $chunked
435 43 0 unless $code
437 0 43 if $code eq '100'
447 0 43 if @junk
452 0 43 if ($method eq 'CONNECT')
457 0 43 if (my(@te) = $response->remove_header('Transfer-Encoding'))
469 0 68 unless (defined $n)
470 0 0 if $!{'EINTR'} or $!{'EWOULDBLOCK'} or $!{'EAGAIN'} or $!{'ENOTTY'}
473 0 68 if $n == -1
475 42 26 unless $n
478 1 42 unless $complete
481 0 43 if (@h)
487 42 1 unless ($drop_connection)
488 0 42 if ($cache_key)
491 0 0 if ($peer_http_version eq '1.1' and not $connection{'close'} or $connection{'keep-alive'})