Branch Coverage

blib/lib/MHFS/HTTP/Server/Client/Request.pm
Criterion Covered Total %
branch 2 192 1.0


line true false branch
27 1 0 if (not eval "use JSON; 1")
28 0 1 unless eval "use JSON::PP; 1"
60 0 0 if ($ipos != -1) { }
0 0 elsif (length $self->{'client'}{'inbuf'} > 8192) { }
61 0 0 if (substr($self->{'client'}{'inbuf'}, 0, $ipos + 2, '') =~ m[^(([^\s]+)\s+([^\s]+)\s+(?:HTTP/1\.([0-1])))\r\n]u) { }
70 0 0 if ($self->{'method'} ne "GET" and $self->{'method'} ne "HEAD" and $self->{'method'} ne "PUT")
88 0 0 if (index($pathStruct{'unsafecollapse'}, "/", length($pathStruct{'unsafecollapse'}) - 1) != -1)
101 0 0 if (defined $value)
102 0 0 if (not defined $qsStruct{$key}) { }
106 0 0 if (ref $qsStruct{$key} ne "ARRAY")
136 0 0 if ($ipos == -1) { }
0 0 elsif (substr($self->{'client'}{'inbuf'}, 0, $ipos + 2, '') =~ /^(([^:]+):\s*(.*))\r\n/u) { }
137 0 0 if (length $self->{'client'}{'inbuf'} > 8192)
155 0 0 if ($self->{'client'}{'serverhostname'})
156 0 0 if (not $self->{'header'}{'Host'} or $self->{'header'}{'Host'} ne $self->{'client'}{'serverhostname'})
168 0 0 if ($self->{'client'}{'X-MHFS-PROXY-KEY'} and $self->{'header'}{'X-MHFS-PROXY-KEY'})
172 0 0 if (not $trusted) { }
175 0 0 if (exists $self->{'header'}{$forbidden})
184 0 0 if $self->{'header'}{'X-Forwarded-For'}
188 0 0 if ($netmap and $self->{'ip'} >> 24 == $netmap->[0])
195 0 0 if (defined $self->{'header'}{'Range'} and $self->{'header'}{'Range'} =~ /^bytes=([0-9]+)\-([0-9]*)$/u)
197 0 0 $2 ne '' ? :
206 0 0 if ($self->{'path'}{'unsafecollapse'} eq $route->[0]) { }
212 0 0 if (index($route->[0], "*", length($route->[0]) - 1) == -1)
213 0 0 if rindex($self->{'path'}{'unsafecollapse'}, substr($route->[0], 0, -1), 0) != 0
225 0 0 defined $self->{'header'}{'Host'} ? :
239 0 0 if (&Encode::is_utf8($fileitem->{'buf'}))
243 0 0 if ($self->{'outheaders'}{'Transfer-Encoding'} and $self->{'outheaders'}{'Transfer-Encoding'} eq "chunked")
257 0 0 unless ($code)
259 0 0 if (defined $self->{'header'}{'_RangeStart'}) { }
269 0 0 if ($code == 206) { }
272 0 0 if (defined $end) { }
0 0 elsif (defined $size) { }
292 0 0 if ($end < $start)
305 0 0 if (not defined $contentlength) { }
327 0 0 unless ($headtext)
337 0 0 if ($opt->{'attachment'}) { }
0 0 elsif ($opt->{'inline'}) { }
344 0 0 if ($filename)
354 0 0 if ($opt->{'allowSAB'})
368 0 0 if ($dataitem->{'fh'})
420 0 0 if ($code == 301) { }
0 0 elsif ($code == 307) { }
438 0 0 $slash != -1 ? :
441 0 0 if ($slash != -1)
447 0 0 if ($qs)
451 0 0 if (ref $qs->{$key} ne 'ARRAY') { }
476 0 0 if ($self->{'method'} ne 'HEAD') { }
478 0 0 unless (open $FH, "<", $requestfile)
485 0 0 unless ($st)
497 0 0 if (defined $start)
498 0 0 if ($start >= $currentsize) { }
0 0 elsif ($fileitem{'fh'}) { }
514 0 0 if ($done)
518 0 0 if (defined $locksz) { }
529 0 0 if (defined $self->{'header'}{'_RangeEnd'})
534 0 0 if ($fileitem{'fh'})
535 0 0 unless ($done)
543 0 0 if (defined $self->{'header'}{'_RangeEnd'})
545 0 0 if $rangesize <= $maxsize
556 0 0 if (index($requestfile, $allowed, length($requestfile) - length($allowed)) != -1)
563 0 0 if ($filelength == '99999999999')
573 0 0 if ($self->{'responseopt'}{'cd_file'})
583 0 0 unless (defined $filelength)
592 0 0 defined $self->{'header'}{'_RangeEnd'} ? :
611 0 0 if (defined $self->{'header'}{'_RangeStart'}) { }
622 0 0 unless open my $cmdh, "-|", @cmd
640 0 0 if (&Encode::is_utf8($buf))
648 0 0 if (not $options->{'code'} or $options->{'code'} == 206)
656 0 0 unless (open $fh, "<", \$buf)
714 0 0 unless ($libtarsize)
757 0 0 if defined $requestfile
760 0 0 if (not defined $requestfile or rindex($requestfile, $droot, 0) != 0) { }
0 0 elsif (-f $requestfile) { }
0 0 elsif (-d _) { }
766 0 0 if (index($request->{'path'}{'unsafecollapse'}, '/', length($request->{'path'}{'unsafecollapse'}) - 1) == -1) { }
776 0 0 if (index($request->{'path'}{'unescapepath'}, '/', length($request->{'path'}{'unescapepath'}) - 1) != -1) { }
778 0 0 if (-f $index)
800 0 0 if defined $requestfile
801 0 0 if (not defined $requestfile or rindex($requestfile, $ml, 0) != 0)
806 0 0 if (-f $requestfile) { }
0 0 elsif (-d _) { }
807 0 0 if (index($self->{'path'}{'unsafecollapse'}, '/', length($self->{'path'}{'unsafecollapse'}) - 1) == -1) { }
817 0 0 if (substr($self->{'path'}{'unescapepath'}, -1) eq '/') { }
818 0 0 unless opendir my $dh, $requestfile
822 0 0 if $filename eq "." or $filename eq ".."
823 0 0 unless -s "$requestfile/$filename"
825 0 0 if -d _
843 0 0 if (length $self->{'client'}{'inbuf'} < $self->{'header'}{'Content-Length'})
851 0 0 if ($dlength >= $contentlength) { }
854 0 0 if ($dlength > $contentlength) { }
877 0 0 if ($self->{'header'}{'Content-Length'} > 20000000)
883 0 0 if (length $self->{'client'}{'inbuf'} < $self->{'header'}{'Content-Length'})
889 0 0 if ($dlength >= $contentlength)
892 0 0 if ($dlength > $contentlength) { }
910 0 0 if &$uploader($self, $requestfile)