Branch Coverage

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


line true false branch
20 0 44 if ($host =~ /:/ and not $host =~ /^\[/)
35 1 43 unless ($sock)
38 0 1 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/) { }
1 0 elsif ($@) { }
81 43 0 if (defined(my $peerhost = $sock->peerhost))
92 0 43 if ($hhost =~ s/^([^\@]*)\@//)
96 0 0 if (defined $1 and not $h->header('Authorization'))
104 1 42 if ($proxy and $url->scheme ne 'https')
109 0 1 if (defined $p_auth)
121 0 0 unless lc $hlist->[$i] eq $k
134 0 44 unless ($method =~ /^[A-Za-z0-9_!\#\$%&\'*+\-.^\`|~]+$/)
155 2 42 $proxy ? :
161 2 42 $proxy && !$ssl_tunnel ? :
0 44 $method eq 'CONNECT' ? :
163 0 42 unless $path =~ m[^/]
170 1 43 if ($conn_cache)
176 0 1 if $ssl_tunnel
177 0 1 if ($socket = $conn_cache->withdraw($self->socket_type, $cache_key))
178 0 0 if ($socket->can_read(0)) { }
191 0 44 if (not $socket and $ssl_tunnel)
193 0 0 unless my $proto_https = LWP::Protocol::create('https', $self->{'ua'})
198 0 0 if (my $upgrade_sub = $proto_https->can('_upgrade_sock')) { }
204 0 0 unless $response->is_success
207 0 0 unless $socket = &$upgrade_sub($proto_https, $response->{'client_socket'}, $url)
214 44 0 unless ($socket)
220 0 43 if (my $proto = $request->protocol)
221 0 0 if ($proto =~ m[^(?:HTTP/)?(1.\d+)$])
224 0 0 if $http_version eq '1.0'
242 0 43 if ref $$content_ref
246 0 43 if (ref $content_ref eq 'CODE') { }
248 0 0 if $clen
249 0 0 unless (defined $clen)
258 2 41 if (defined $$content_ref and length $$content_ref) { }
0 41 elsif ($clen) { }
260 2 0 if (not defined $clen or $clen ne $has_content)
261 0 2 if (defined $clen)
275 0 43 if ($request_headers->header('Expect') || '') =~ /100-continue/
281 0 2 if (not $has_content or $write_wait or $has_content > 8192)
287 0 41 unless (defined $n)
288 0 0 if $!{'EINTR'}
289 0 0 if ($!{'EWOULDBLOCK'} or $!{'EAGAIN'})
295 41 0 if ($n) { }
301 0 41 if length $req_buf
308 2 41 if ($has_content)
313 0 2 if ($write_wait) { }
0 2 elsif (ref $content_ref eq 'CODE') { }
322 0 0 unless defined $buf
323 0 0 if $chunked
325 0 0 if $req_buf
329 2 0 if ($req_buf) { }
346 0 2 if ($write_wait)
347 0 0 if $write_wait < $sel_timeout
350 2 0 if $sel_timeout
353 0 2 $write_wait ? :
358 0 2 if ($nfound < 0)
359 0 0 if ($!{'EINTR'} or $!{'EWOULDBLOCK'} or $!{'EAGAIN'})
360 0 0 if ($time_before)
362 0 0 if $sel_timeout < 0
370 0 2 if ($write_wait)
372 0 0 if $write_wait < 0
375 0 2 if (defined $rbits and $rbits =~ /[^\0]/)
379 0 0 defined $n ? :
380 0 0 unless $!{'EINTR'} or $!{'EWOULDBLOCK'} or $!{'EAGAIN'}
391 0 0 if (not $code and $buf =~ /\015?\012\015?\012/)
396 0 0 if ($code eq '100') { }
408 2 0 if (defined $wbits and $wbits =~ /[^\0]/)
410 2 0 defined $n ? :
411 0 0 unless $!{'EINTR'} or $!{'EWOULDBLOCK'} or $!{'EAGAIN'}
419 0 2 if (not $eof and $woffset >= length $$wbuf)
422 0 0 unless defined $buf
423 0 0 unless length $buf
424 0 0 if $chunked
433 43 0 unless $code
435 0 43 if $code eq '100'
445 0 43 if @junk
450 0 43 if ($method eq 'CONNECT')
455 0 43 if (my(@te) = $response->remove_header('Transfer-Encoding'))
467 0 68 unless (defined $n)
468 0 0 if $!{'EINTR'} or $!{'EWOULDBLOCK'} or $!{'EAGAIN'} or $!{'ENOTTY'}
471 0 68 if $n == -1
473 42 26 unless $n
476 1 42 unless $complete
479 0 43 if (@h)
485 42 1 unless ($drop_connection)
486 0 42 if ($cache_key)
489 0 0 if ($peer_http_version eq '1.1' and not $connection{'close'} or $connection{'keep-alive'})