Branch Coverage

blib/lib/AnyEvent/HTTP.pm
Criterion Covered Total %
branch 35 250 14.0


line true false branch
427 8 16 if (my $cb = shift @{$CO_SLOT{$host}[1];}) { }
439 8 8 unless $CO_SLOT{$host}[0]
459 0 0 if $jar->{'version'} != 1
464 0 0 unless ref $paths
468 0 0 if (exists $kv->{'_expires'}) { }
0 0 elsif ($session_end) { }
470 0 0 if $anow > $kv->{'_expires'}
476 0 0 unless %$cookies
480 0 0 unless %$paths
489 0 0 if $jar->{'version'} != 1
494 0 0 unless ref $paths
496 0 0 if ($chost =~ /^\./u) { }
0 0 elsif ($chost =~ /\./u) { }
497 0 0 unless $chost eq substr($host, -length($chost))
499 0 0 unless $chost eq $host
505 0 0 unless $cpath eq substr($path, 0, length $cpath)
508 0 0 if $scheme ne 'https' and exists $kv->{'secure'}
510 0 0 if (exists $kv->{'_expires'} and &AE::now() > $kv->{'_expires'})
517 0 0 if ($value =~ /[=;,[:space:]]/u)
555 0 0 if (defined $1) { }
0 0 elsif (defined $3) { }
565 0 0 @kv ? :
567 0 0 unless /\G\s*;/cgu
570 0 0 unless @kv
575 0 0 if (exists $kv{'max-age'}) { }
0 0 elsif (exists $kv{'expires'}) { }
587 0 0 if (exists $kv{'domain'}) { }
592 0 0 if $cdom =~ /\.$/u
596 0 0 $cdom =~ /\.[^.][^.]\.[^.][^.]$/u ? :
0 0 if $ndots < ($cdom =~ /\.[^.][^.]\.[^.][^.]$/u ? 3 : 2)
605 0 0 if /\G\s*,/cgu
618 0 0 unless @{$KA_CACHE{$ka_key};}
635 0 0 @ka ? :
666 0 0 unless /\G$/u
689 0 8 if $state->{'handle'}
746 8 0 if $arg{'tls_ctx'} eq 'low' or not exists $arg{'tls_ctx'}
747 0 8 if $arg{'tls_ctx'} eq 'high'
751 0 8 if (my $hdr = $arg{'headers'})
759 0 8 if exists $arg{'Redirect'}
761 0 8 exists $arg{'recurse'} ? :
763 0 8 if $recurse < 0
766 0 8 exists $arg{'proxy'} ? :
774 0 0 $uscheme eq 'https' ? :
8 0 $uscheme eq 'http' ? :
778 0 8 unless $uauthority =~ /^(?: .*\@ )? ([^\@]+?) (?: : (\d+) )?$/ux
782 5 3 if defined $2
785 5 3 defined $2 ? :
8 0 unless exists $hdr{'host'}
788 0 8 if length $query
793 0 8 if (my $jar = $arg{'cookie_jar'})
796 0 0 if @$cookies
802 0 8 if ($proxy) { }
805 0 0 unless defined $rscheme
809 0 0 if $uscheme eq 'https' and $rscheme eq 'https'
818 8 0 unless exists $hdr{'referer'}
819 8 0 unless exists $hdr{'user-agent'}
822 0 8 if length $arg{'body'} or $method ne 'GET'
827 0 8 exists $arg{'persistent'} ? :
828 0 8 exists $arg{'keepalive'} ? :
834 8 0 $keepalive ? :
8 0 $persistent ? :
835 8 0 unless exists $hdr{'te'}
847 0 0 if $uscheme eq 'https' and not exists $hdl->{'tls'}
858 0 0 unless %state
865 0 0 unless %state
870 0 0 unless m[^HTTP/0*([0-9\.]+) \s+ ([0-9]{3}) (?: \s+ ([^\012]*) )? \012]cgiux
879 0 0 if $2 eq 100
887 0 0 unless my $hdr = &_parse_hdr()
896 0 0 if (exists $hdr{'location'})
899 0 0 if ($loc =~ m[^//]u) { }
0 0 elsif ($loc eq '') { }
0 0 elsif (not $loc =~ m[^(?: $ | [^:/?\#]+ : )]ux) { }
908 0 0 if (not $loc =~ /^[.?#]/u) { }
0 0 elsif (eval { do { require URI } }) { }
911 0 0 unless ($loc =~ s[^/][]u)
934 0 0 if ($recurse)
943 0 0 if ($status == 301 or $status == 302 or $status == 303) { }
0 0 elsif ($status == 307 or $status == 308) { }
946 0 0 unless ($method eq 'HEAD')
956 0 0 if ($state{'handle'})
958 0 0 $hdr{'HTTPVersion'} < 1.1 ? :
0 0 if ($persistent and $_[3] and $hdr{'HTTPVersion'} < 1.1 ? $hdr{'connection'} =~ /\bkeep-?alive\b/iu : !($hdr{'connection'} =~ /\bclose\b/iu)) { }
974 0 0 if (defined $_[1])
980 0 0 if ($arg{'cookie_jar'})
984 0 0 if ($redirect and exists $hdr{'location'}) { }
1008 0 0 $chunked ? :
1016 0 0 if (not $redirect and $arg{'on_header'} and not $arg{'on_header'}->(\%hdr)) { }
0 0 elsif ($hdr{'Status'} =~ /^(?:1..|204|205|304)$/u or $method eq 'HEAD' or defined $len and $len == 0) { }
0 0 elsif (not $redirect and $arg{'want_body_handle'}) { }
0 0 elsif ($chunked) { }
0 0 elsif ($arg{'on_body'}) { }
1039 0 0 unless $_[1] =~ /^([0-9a-fA-F]+)/u
1044 0 0 if ($len) { }
1048 0 0 unless &$on_body($_[1], \%hdr)
1052 0 0 if length $_[1]
1061 0 0 if (length $_[1])
1065 0 0 unless my $hdr = &_parse_hdr()
1080 0 0 if (defined $len) { }
1084 0 0 unless $arg{'on_body'}->(delete $_[0]{'rbuf'}, \%hdr)
1087 0 0 unless $len > 0
1095 0 0 unless $arg{'on_body'}->(delete $_[0]{'rbuf'}, \%hdr)
1102 0 0 if (defined $len) { }
1105 0 0 if $len <= length $_[0]{'rbuf'}
1111 0 0 $! == 32 || !$! ? :
1120 0 0 if ($was_persistent and $idempotent) { }
1139 0 0 unless %state
1166 8 0 unless my $fh = shift()
1169 0 0 unless delete $state{'connect_guard'}
1184 0 0 if ($proxy and $uscheme eq 'https') { }
1188 0 0 exists $hdr{'proxy-authorization'} ? :
1194 0 0 unless $_[1] =~ m[^HTTP/([0-9\.]+) \s+ ([0-9]{3}) (?: \s+ ([^\015\012]*) )?]iux
1197 0 0 if ($2 == 200) { }
1205 0 0 unless $proxy
1214 0 8 unless $state{'connect_guard'}
1218 0 8 if ($persistent and $KA_CACHE{$ka_key}) { }
1223 0 0 if $state{'handle'}->destroyed
1226 0 0 if $state{'handle'}->destroyed
1238 0 8 if defined wantarray
1395 0 0 if ($date =~ /^[A-Z][a-z][a-z]+, ([0-9][0-9]?)[\- ]([A-Z][a-z][a-z])[\- ]([0-9][0-9][0-9][0-9]) ([0-9][0-9]?):([0-9][0-9]?):([0-9][0-9]?) GMT$/u) { }
0 0 elsif ($date =~ /^[A-Z][a-z][a-z]+, ([0-9][0-9]?)-([A-Z][a-z][a-z])-([0-9][0-9]) ([0-9][0-9]?):([0-9][0-9]?):([0-9][0-9]?) GMT$/u) { }
0 0 elsif ($date =~ /^[A-Z][a-z][a-z]+ ([A-Z][a-z][a-z]) ([0-9 ]?[0-9]) ([0-9][0-9]?):([0-9][0-9]?):([0-9][0-9]?) ([0-9][0-9][0-9][0-9])$/u) { }
1403 0 0 $3 < 69 ? :
1412 0 0 if ($m eq $month[$_])
1422 0 3 if (length $_[0]) { }
1423 0 0 unless $_[0] =~ m[^(http):// ([^:/]+) (?: : (\d*) )?]iux