Branch Coverage

blib/lib/Net/HTTPServer.pm
Criterion Covered Total %
branch 27 308 8.7


line true false branch
502 3 0 if ($address)
506 3 0 if $temp
528 0 3 if ($$self{'CFG'}{'LOG'} eq 'STDOUT') { }
536 0 3 unless (defined $$self{'LOG'})
547 0 3 if (ref $$self{'DEBUG'} eq 'ARRAY' and $#{$$self{'DEBUG'};} > -1)
555 0 0 if ($$self{'DEBUGLOG'} eq 'STDOUT') { }
564 0 0 unless (defined $$self{'DEBUGLOG'})
574 3 0 unless (defined $$self{'CFG'}{'MIMETYPES'})
578 3 6 if (-e "$lib/Net/HTTPServer/mime.types")
588 3 0 if ($Net::HTTPServer::DigestMD5)
597 2 1 if ($$self{'CFG'}{'SESSIONS'})
599 2 0 if (-d $$self{'CFG'}{'DATADIR'})
604 2 0 unless (-d $$self{'CFG'}{'DATADIR'})
631 0 0 if ($token =~ / /)
652 0 0 unless (defined $$self{'SOCK'})
658 0 0 if defined $timeout
665 0 0 if ($$self{'CFG'}{'TYPE'} eq 'single') { }
0 0 elsif ($$self{'CFG'}{'TYPE'} eq 'forking') { }
674 0 0 if defined $timestop and $timestop - time <= 0
696 0 0 if ($method ne 'basic' and $method ne 'digest')
701 0 0 if ($method eq 'basic' or $method eq 'digest')
703 0 0 unless ($Net::HTTPServer::Base64)
710 0 0 if ($method eq 'digest')
712 0 0 unless ($Net::HTTPServer::DigestMD5)
759 0 0 if (ref $url eq 'HASH') { }
787 0 0 $port eq 'scan' ? :
788 0 0 if $scan
796 0 0 if ($$self{'CFG'}{'SSL'} == 0) { }
798 0 0 $^O ne 'MSWin32' ? :
810 0 0 unless (defined $$self{'CFG'}{'SSL_KEY'} and defined $$self{'CFG'}{'SSL_CERT'} and defined $$self{'CFG'}{'SSL_CA'})
818 0 0 $^O ne 'MSWin32' ? :
832 0 0 if defined $$self{'SOCK'}
833 0 0 if $port == 9999
834 0 0 unless $scan
839 0 0 unless (defined $$self{'SOCK'})
842 0 0 if ($$self{'CFG'}{'SSL'} == 0) { }
856 0 0 if ($$self{'CFG'}{'TYPE'} eq 'forking')
883 0 0 if ($$self{'CFG'}{'TYPE'} eq 'forking')
888 0 0 if (exists $$self{'SELECT'} and defined $$self{'SELECT'})
893 0 0 if (exists $$self{'SOCK'} and defined $$self{'SOCK'})
920 0 0 unless defined $authURL
925 0 0 if ($$self{'AUTH'}{$authURL}{'method'} eq 'basic') { }
0 0 elsif ($$self{'AUTH'}{$authURL}{'method'} eq 'digest') { }
957 0 0 unless $requestObj->Header('Authorization')
965 0 0 if lc $method ne 'basic'
977 0 0 if $code eq '401'
978 0 0 if $password ne $real_password
979 0 0 if $code eq '403'
1013 0 0 unless $requestObj->Header('Authorization')
1021 0 0 if lc $method ne 'digest'
1034 0 0 if $requestObj->URL ne $authorization{'uri'}
1047 0 0 if $code eq '401'
1048 0 0 if $kd ne $authorization{'response'}
1049 0 0 if $code eq '403'
1056 0 0 if ($privatekey ne $$self{'PRIVATEKEY'})
1063 0 0 if (time - $time > 30)
1096 0 0 if $requestObj->_failure eq 'expect'
1099 0 0 unless exists $Net::HTTPServer::ALLOWED{$requestObj->Method}
1102 0 0 unless $requestObj->Header('Host')
1105 0 0 if $requestObj->Header('Transfer-Encoding') and $requestObj->Header('Transfer-Encoding') ne 'identity'
1109 0 0 if $requestObj->Method eq 'OPTIONS'
1112 0 0 if $requestObj->Method eq 'TRACE'
1122 0 0 unless defined $reqPath
1124 0 0 if (exists $$self{'CALLBACKS'}{$reqPath}) { }
0 0 elsif (exists $$self{'CALLBACKS'}{$reqPath1}) { }
0 0 elsif (exists $$self{'CALLBACKS'}{$reqPath2}) { }
0 0 elsif (my $regex = $self->_RegexMatch($reqPath)) { }
0 0 elsif (defined $$self{'CFG'}{'DOCROOT'} and -e $$self{'CFG'}{'DOCROOT'} . '/' . $reqPath) { }
1148 0 0 if (-d $$self{'CFG'}{'DOCROOT'} . '/' . $reqPath)
1154 0 0 unless $reqPath =~ m[/$]
1159 0 0 if (exists $$self{'CALLBACKS'}{$testPath})
1167 0 0 if (-f $$self{'CFG'}{'DOCROOT'} . '/' . $testPath)
1183 0 0 unless $reqPath =~ m[/$]
1188 0 0 if (exists $$self{'CALLBACKS'}{$testPath})
1200 0 0 if ($method eq 'callback') { }
0 0 elsif ($method eq 'file') { }
1203 0 0 if defined $auth
1206 0 0 if ($$self{'CFG'}{'OLDREQUEST'}) { }
1222 0 0 if defined $auth
1272 0 0 unless exists $$self{'REGEXCALLBACKS'}
1276 0 0 if $reqPath =~ /$regex/
1299 0 0 unless ($responseObj->Header('Location'))
1304 0 0 unless $responseObj->Header('Content-Type')
1310 0 0 if ($requestObj->Header('Accept'))
1312 0 0 unless $self->_accept($requestObj->Header('Accept'), $responseObj->Header('Content-Type'))
1323 0 0 unless $responseObj->Header('Content-Length')
1333 0 0 if $requestObj->Method eq 'HEAD'
1335 0 0 if ($requestObj->Method eq 'TRACE')
1348 0 0 if ($responseObj->Header('Content-Type') eq 'text/html' or $responseObj->Header('Content-Type') eq 'text/plain')
1358 0 0 unless defined $self->_send($client, $header)
1359 0 0 unless defined $self->_send($client, $body)
1378 0 0 if (-d $fullpath)
1382 0 0 unless ($path =~ m[/$])
1391 0 0 unless (-f $fullpath)
1398 0 0 unless defined $fileHandle
1403 0 0 if ($ext ne '' and exists $$self{'MIMETYPES'}{$ext}) { }
0 0 elsif (-T $fullpath) { }
1517 0 0 if $file eq '.'
1518 0 0 if $file eq '..' and $path eq '/'
1520 0 0 if ($file =~ /\:/) { }
1738 0 0 if time >= $timeEnd
1741 0 0 if ($headers eq '')
1744 0 0 if ($headers =~ /^Content-Length\s*:\s*(\d+)\015?\012?$/im)
1751 0 0 if (not $met_expectation and $request =~ /^Expect\s*:\s*(.+?)\015?\012?$/im)
1754 0 0 if ($expect eq '100-continue') { }
1769 0 0 if (length $request == length($headers) + $body_length) { }
1777 0 0 unless defined $status
1778 0 0 if $status == 0
1779 0 0 if time >= $timeEnd
1799 0 0 if ($select->can_read(0.01))
1802 0 0 if (not defined $status) { }
0 0 elsif ($status == 0) { }
1835 0 0 if (ref $data eq '')
1837 0 0 unless defined $self->_send_data($sock, $data)
1839 0 0 if (ref $data eq 'FileHandle')
1843 0 0 unless defined $self->_send_data($sock, $temp)
1871 0 0 if (defined $written) { }
1911 0 0 if (scalar keys %{$$self{'CHILDREN'};} > 0)
1947 0 0 if (exists $$self{'CHILDREN'}{$pid})
1966 0 0 unless defined($pid = fork)
1968 0 0 if ($pid) { }
1984 0 0 if ($$self{'SELECT'}->can_read)
1988 0 0 unless defined $client
2016 0 0 if (defined $request)
2028 0 0 if ($other_end)
2035 0 0 if $hostname
2038 0 0 if defined $$self{'CFG'}{'DOCROOT'}
2041 0 0 if defined $requestObj->Header('Referer')
2043 0 0 if defined $requestObj->Header('User-Agent')
2068 0 0 if $$self{'CFG'}{'SSL'} == 0
2069 0 0 if $$self{'CFG'}{'SSL'} == 1
2088 0 0 defined $timestop ? :
2094 0 0 if ($$self{'SELECT'}->can_read($wait))
2100 0 0 if (defined $client)
2134 0 0 if $testType eq $contentType
2135 0 0 if $testType eq "$mainType/*"
2136 0 0 if $testType eq '*/*'
2155 7 47 exists $$self{'ARGS'}{$arg} ? :
2157 3 51 if (defined $valid)
2162 3 3 if $check eq $val
2164 0 3 if ($pass == 0)
2189 0 0 if ($check eq '')
2194 0 0 if exists $$self{'AUTH'}{$check}
2211 0 0 unless defined $time
2212 0 0 if defined $delta
2242 0 0 if exists $$self{'DEBUGZONES'}{$zone} or exists $$self{'DEBUGZONES'}{'ALL'}
2311 0 0 if (exists $$auth{'qop'} and $$auth{'qop'} eq 'auth')
2356 66 1857 if /^\#/
2357 39 1818 if /^\s+$/
2361 1125 693 if $extensions =~ /^\s*$/
2367 0 963 if $ext eq ''
2390 0 0 if ($^O eq 'MSWin32' or $^O eq 'cygwin')
2394 0 0 unless ioctl $socket, $FIONBIO, \$temp
2404 0 0 unless fcntl $socket, 4, $flags | 2048