Branch Coverage

blib/lib/AnyEvent/HTTP.pm
Criterion Covered Total %
branch 35 244 14.3


line true false branch
440 8 16 if (my $cb = shift @{$CO_SLOT{$host}[1];}) { }
452 8 8 unless $CO_SLOT{$host}[0]
472 0 0 if $jar->{'version'} != 2
477 0 0 unless ref $paths
481 0 0 if (exists $kv->{'_expires'}) { }
0 0 elsif ($session_end) { }
483 0 0 if $anow > $kv->{'_expires'}
489 0 0 unless %$cookies
493 0 0 unless %$paths
502 0 0 if $jar->{'version'} != 2
504 0 0 if $host =~ /[^\x00-\x7f]/u
510 0 0 unless ref $paths
513 0 0 unless $chost eq $host or ".$chost" eq substr($host, -1 - length($chost))
517 0 0 unless $cpath eq substr($path, 0, length $cpath)
520 0 0 if $scheme ne 'https' and exists $kv->{'secure'}
522 0 0 if (exists $kv->{'_expires'} and &AE::now() > $kv->{'_expires'})
529 0 0 if ($value =~ /[=;,[:space:]]/u)
546 0 0 if $jar->{'version'} != 2
569 0 0 if (defined $1) { }
0 0 elsif (defined $3) { }
579 0 0 @kv ? :
581 0 0 unless /\G\s*;/cgu
584 0 0 unless @kv
589 0 0 if (exists $kv{'max-age'}) { }
0 0 elsif (exists $kv{'expires'}) { }
601 0 0 if (exists $kv{'domain'}) { }
606 0 0 if $cdom =~ /\.$/u
610 0 0 $cdom =~ /\.[^.][^.]\.[^.][^.]$/u ? :
0 0 if $ndots < ($cdom =~ /\.[^.][^.]\.[^.][^.]$/u ? 3 : 2)
621 0 0 if /\G\s*,/cgu
634 0 0 unless @{$KA_CACHE{$ka_key};}
651 0 0 @ka ? :
682 0 0 unless /\G$/u
705 0 8 if $state->{'handle'}
762 8 0 if $arg{'tls_ctx'} eq 'low' or not exists $arg{'tls_ctx'}
763 0 8 if $arg{'tls_ctx'} eq 'high'
767 0 8 if (my $hdr = $arg{'headers'})
775 0 8 if exists $arg{'Redirect'}
777 0 8 exists $arg{'recurse'} ? :
779 0 8 if $recurse < 0
782 0 8 exists $arg{'proxy'} ? :
790 0 0 $uscheme eq 'https' ? :
8 0 $uscheme eq 'http' ? :
794 0 8 unless $uauthority =~ /^(?: .*\@ )? ([^\@]+?) (?: : (\d+) )?$/ux
798 5 3 if defined $2
801 5 3 defined $2 ? :
8 0 unless exists $hdr{'host'}
804 0 8 if length $query
809 0 8 if (my $jar = $arg{'cookie_jar'})
812 0 0 if @$cookies
818 0 8 if ($proxy) { }
821 0 0 unless defined $rscheme
825 0 0 if $uscheme eq 'https' and $rscheme eq 'https'
834 8 0 unless exists $hdr{'referer'}
835 8 0 unless exists $hdr{'user-agent'}
838 0 8 if length $arg{'body'} or $method ne 'GET'
843 0 8 exists $arg{'persistent'} ? :
844 0 8 exists $arg{'keepalive'} ? :
850 8 0 $keepalive ? :
8 0 $persistent ? :
851 8 0 unless exists $hdr{'te'}
863 0 0 if $uscheme eq 'https' and not exists $hdl->{'tls'}
874 0 0 unless %state
881 0 0 unless %state
886 0 0 unless m[^HTTP/0*([0-9\.]+) \s+ ([0-9]{3}) (?: \s+ ([^\012]*) )? \012]cgiux
895 0 0 if $2 eq 100
903 0 0 unless my $hdr = &_parse_hdr()
912 0 0 if (exists $hdr{'location'})
915 0 0 if ($loc =~ m[^//]u) { }
0 0 elsif ($loc eq '') { }
0 0 elsif (not $loc =~ m[^(?: $ | [^:/?\#]+ : )]ux) { }
924 0 0 if (not $loc =~ /^[.?#]/u) { }
0 0 elsif (eval { do { require URI } }) { }
927 0 0 unless ($loc =~ s[^/][]u)
950 0 0 if ($recurse)
959 0 0 if ($status == 301 or $status == 302 or $status == 303) { }
0 0 elsif ($status == 307 or $status == 308) { }
962 0 0 unless ($method eq 'HEAD')
972 0 0 if ($state{'handle'})
974 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)) { }
990 0 0 if (defined $_[1])
996 0 0 if ($arg{'cookie_jar'})
1000 0 0 if ($redirect and exists $hdr{'location'}) { }
1024 0 0 $chunked ? :
1032 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 (not $redirect and $arg{'on_body'}) { }
1055 0 0 unless $_[1] =~ /^([0-9a-fA-F]+)/u
1060 0 0 if ($len) { }
1064 0 0 unless &$on_body($_[1], \%hdr)
1068 0 0 if length $_[1]
1077 0 0 if (length $_[1])
1081 0 0 unless my $hdr = &_parse_hdr()
1096 0 0 if (defined $len) { }
1100 0 0 unless $arg{'on_body'}->(delete $_[0]{'rbuf'}, \%hdr)
1103 0 0 unless $len > 0
1111 0 0 unless $arg{'on_body'}->(delete $_[0]{'rbuf'}, \%hdr)
1118 0 0 if (defined $len) { }
1121 0 0 if $len <= length $_[0]{'rbuf'}
1127 0 0 $! == 32 || !$! ? :
1136 0 0 if ($was_persistent and $idempotent) { }
1155 0 0 unless %state
1182 8 0 unless my $fh = shift()
1185 0 0 unless delete $state{'connect_guard'}
1200 0 0 if ($proxy and $uscheme eq 'https') { }
1204 0 0 exists $hdr{'proxy-authorization'} ? :
1210 0 0 unless $_[1] =~ m[^HTTP/([0-9\.]+) \s+ ([0-9]{3}) (?: \s+ ([^\015\012]*) )?]iux
1213 0 0 if ($2 == 200) { }
1221 0 0 unless $proxy
1230 0 8 unless $state{'connect_guard'}
1234 0 8 if ($persistent and $KA_CACHE{$ka_key}) { }
1255 0 8 if defined wantarray
1412 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) { }
1420 0 0 $3 < 69 ? :
1429 0 0 if ($m eq $month[$_])
1439 0 3 if (length $_[0]) { }
1440 0 0 unless $_[0] =~ m[^(http):// ([^:/]+) (?: : (\d*) )?]iux