Branch Coverage

blib/lib/App/Phoebe.pm
Criterion Covered Total %
branch 0 620 0.0


line true false branch
198 0 0 unless $stream
207 0 0 if $err
210 0 0 if $err
211 0 0 if $ipaddr
230 0 0 if (keys %{$$server{'host'};} > 1) { }
0 0 elsif (@{$App::Phoebe::server->{'wiki_space'};}) { }
255 0 0 if ($lang) { }
274 0 0 unless $data->{'upload'} ||= is_upload($stream, $data->{'request'})
277 0 0 if ($actual == $size) { }
0 0 elsif ($actual > $size) { }
300 0 0 unless $@
313 0 0 if ($type ne 'text/plain') { }
0 0 elsif ($length == 0) { }
0 0 elsif (utf8::decode($data)) { }
314 0 0 if ($length == 0) { }
341 0 0 if (-e $lock)
344 0 0 if -e $lock and $age > 5
346 0 0 if (mkdir $lock) { }
0 0 elsif ($count > 25) { }
349 0 0 if ($@)
377 0 0 if (-e $file) { }
379 0 0 if ($old eq $text)
384 0 0 unless -d "$dir/keep"
385 0 0 if (-d "$dir/keep/$id") { }
387 0 0 if /^(\d+)\.gmi$/u and $1 > $revision
397 0 0 if (not open(my $fh, '>>:encoding(UTF-8)', $index)) { }
407 0 0 if (not open(my $fh, '>>:encoding(UTF-8)', $changes)) { }
416 0 0 unless -d "$dir/page"
418 0 0 if ($@) { }
435 0 0 if (-e $file)
437 0 0 unless -d "$dir/keep"
438 0 0 if (-d "$dir/keep/$id") { }
440 0 0 if /^(\d+)\.gmi$/u and $1 > $revision
451 0 0 if (-f $index)
457 0 0 if (not open(my $fh, '>>:encoding(UTF-8)', $changes)) { }
475 0 0 if $data->{'buffer'}
496 0 0 if (run_extensions($stream, $url)) { }
0 0 elsif (not $url) { }
0 0 elsif (length $url > 1024) { }
0 0 elsif (($host, $n, $space) = $url =~ m[^(?:gemini:)?//($hosts)(:$port)?(?:/($spaces))?/(?:$reserved)$]u) { }
0 0 elsif (($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/?$]u) { }
0 0 elsif (($host, $space, $n) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/more(?:/(\d+))?$]u) { }
0 0 elsif (($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/index$]u) { }
0 0 elsif (($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/files$]u) { }
0 0 elsif (($host) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/spaces$]u) { }
0 0 elsif (($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/data$]u) { }
0 0 elsif ($url =~ m[^(?:gemini:)?//($hosts)(?::$port)?/do/source$]u) { }
0 0 elsif ($url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/match$]u) { }
0 0 elsif ($query and ($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/match\?]u) { }
0 0 elsif ($url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/search$]u) { }
0 0 elsif ($query and ($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/search\?]u) { }
0 0 elsif ($url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/new$]u) { }
0 0 elsif ($query and ($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/new\?]u) { }
0 0 elsif (($host, $space, $n, $style) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/changes(?:/(\d+))?(?:/(colour|fancy))?$]u) { }
0 0 elsif (($host, $filter, $n, $style) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?/do/all(?:/(latest))?/changes(?:/(\d+))?(?:/(colour|fancy))?$]u) { }
0 0 elsif (($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/rss$]u) { }
0 0 elsif (($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/blog/rss$]u) { }
0 0 elsif (($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/atom$]u) { }
0 0 elsif (($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/blog/atom$]u) { }
0 0 elsif (($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/all/atom$]u) { }
0 0 elsif (($host) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?/robots.txt(?:[#?].*)?$]u) { }
0 0 elsif (($host, $space, $id, $n, $style) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/history/([^/]*)(?:/(\d+))?(?:/(colour|fancy))?$]u) { }
0 0 elsif (($host, $space, $id, $n, $style) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/diff/([^/]*)(?:/(\d+))?(?:/(colour))?$]u) { }
0 0 elsif (($host, $space, $id, $n) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/raw/([^/]*)(?:/(\d+))?$]u) { }
0 0 elsif (($host, $space, $id, $n) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/html/([^/]*)(?:/(\d+))?$]u) { }
0 0 elsif (($host, $space, $id, $n) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/page/([^/]+)(?:/(\d+))?$]u) { }
0 0 elsif (($host, $space, $id) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/file/([^/]+)?$]u) { }
0 0 elsif (($host) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(/|$)]u) { }
0 0 elsif ($authority) { }
508 0 0 $n ? :
538 0 0 if ($space) { }
583 0 0 if $@
590 0 0 if &$sub(@_)
602 0 0 if ($page) { }
623 0 0 if @{$App::Phoebe::server->{'wiki_space'};} or keys %{$$server{'host'};} > 1
633 0 0 if ($data->{'buffer'} =~ /^(.*)\r\n/u) { }
639 0 0 if ($data->{'request'} =~ /$re/iu)
660 0 0 if $data->{'buffer'}
671 0 0 if (/^(\S+?): (.+?)\s*$/u) { }
0 0 elsif ($_ eq '') { }
679 0 0 if $data->{'headers'}{'host'} and not $data->{'headers'}{'host'} =~ /:\d+$/u
682 0 0 unless $length =~ /^\d+$/u
683 0 0 if $length > $App::Phoebe::server->{'wiki_page_size_limit'}
685 0 0 if $actual > $length
686 0 0 if ($length == $actual) { }
0 0 elsif ($length) { }
699 0 0 if ($data->{'header_size'} and $data->{'header_size'} > $App::Phoebe::server->{'wiki_page_size_limit'})
718 0 0 if ($length == $actual)
746 0 0 if ($space)
747 0 0 if $space eq $host
754 0 0 $space ? :
763 0 0 unless ($id)
770 0 0 $space && $space ne $host ? :
782 0 0 unless ($id)
785 0 0 if $id =~ /^$full_url_regex$/u
815 0 0 unless (-f $index)
816 0 0 unless -d "$dir/page"
822 0 0 if $re
840 0 0 unless @blog
846 0 0 if @blog > $n
847 0 0 if $n == 10
848 0 0 if $n == 10
858 0 0 unless @blog
881 0 0 if ($page) { }
890 0 0 if ($page) { }
905 0 0 if @{$App::Phoebe::server->{'wiki_mime_type'};}
907 0 0 if @{$App::Phoebe::server->{'wiki_space'};} or keys %{$$server{'host'};} > 1
945 0 0 unless (@blog)
953 0 0 if @blog > $n
964 0 0 unless @pages
989 0 0 if (@pages) { }
1007 0 0 unless -d $dir
1009 0 0 if $re
1021 0 0 unless @files
1046 0 0 if (@files) { }
1103 0 0 if (-e $file and time - modified($file) <= 300) { }
1115 0 0 if (system(@command) == 0) { }
1131 0 0 unless ($match)
1140 0 0 unless @pages
1151 0 0 unless ($str)
1159 0 0 if (not search($stream, $host, $space, $str, sub { highlight($stream, @_); } ))
1171 0 0 unless @pages
1175 0 0 if ($id =~ /$str/iu or $text =~ /$str/iu)
1199 0 0 if (($j = index($text, $1)) > -1)
1202 0 0 if $start == -1
1204 0 0 if $end == -1
1224 0 0 if (not $style) { }
0 0 elsif ($style eq 'colour') { }
0 0 elsif ($style eq 'fancy') { }
1228 0 0 if @{$App::Phoebe::server->{'wiki_space'};}
1233 0 0 unless (-e $log)
1246 0 0 unless $_ = &decode_utf8(scalar $fh->readline)
1248 0 0 unless changes($stream, $n, sub { $stream->write(&encode_utf8('## ' . (shift()) . "\n")); } , sub { $stream->write((shift()) . ' by ' . colourize($stream, shift(), $style) . "\n"); } , sub { print_link($stream, @_); } , sub { $stream->write(&encode_utf8(join("\n", @_, ''))); } , sub { return unless $_ = &decode_utf8(scalar $fh->readline); chomp $_; split(/\x1f/u, $_, 0), $host, $space, 0; } )
1250 0 0 $style ? :
1274 0 0 if @{$App::Phoebe::server->{'wiki_space'};}
1280 0 0 unless (-e $log)
1296 0 0 unless $_ = &decode_utf8(scalar $fh->readline)
1299 0 0 unless $more
1309 0 0 $filter ? :
1314 0 0 unless (@$log)
1318 0 0 $filter ? :
1319 0 0 $style ? :
1320 0 0 if (not $style) { }
0 0 elsif ($style eq 'colour') { }
0 0 elsif ($style eq 'fancy') { }
1323 0 0 if ($filter) { }
1327 0 0 $filter ? :
1335 0 0 if @$log
1337 0 0 unless changes($stream, $n, sub { $stream->write('## ' . (shift()) . "\n"); } , sub { $stream->write((shift()) . ' by ' . colourize($stream, shift(), $style) . "\n"); } , sub { print_link($stream, @_); } , sub { $stream->write(&encode_utf8(join("\n", @_, ''))); } , sub { @{shift @$log;}, 1 if @$log; } , undef, $filter)
1339 0 0 $style ? :
1347 0 0 $filter ? :
1363 0 0 if ($filter) { }
1367 0 0 unless (@$log)
1379 0 0 if @$log
1382 0 0 unless $more
1397 0 0 if $space
1399 0 0 unless -f $changes
1401 0 0 unless my $fh = 'File::ReadBackwards'->new($changes)
1402 0 0 if (keys %{$$server{'host'};} > 1) { }
1423 0 0 unless $_ and $_ ne "\n"
1424 0 0 if $filter and not /$filter/u
1466 0 0 unless $ts and $id
1468 0 0 if $filter eq 'latest' and $seen{$name}
1470 0 0 if ($day ne $last_day)
1475 0 0 if ($revision eq "\x{1f5b9}") { }
0 0 elsif ($revision eq "\x{1f5bb}") { }
0 0 elsif ($revision > 0) { }
1486 0 0 if ($seen{$name}) { }
0 0 elsif ($filter eq 'latest') { }
1488 0 0 if &$kept($host, $space, $id, $revision)
1500 0 0 if ($seen{$name . "\034"}) { }
1517 0 0 if ($show_space)
1518 0 0 if (keys %{$$server{'host'};} > 1) { }
0 0 elsif ($space) { }
1519 0 0 if ($space) { }
1536 0 0 unless $style
1537 0 0 if ($style eq 'colour') { }
0 0 elsif ($style eq 'fancy') { }
1612 0 0 if (-e $log and my $fh = 'File::ReadBackwards'->new($log))
1615 0 0 unless $_ = &decode_utf8(scalar $fh->readline)
1618 0 0 if $seen{$id}
1691 0 0 if (-e $log and my $fh = 'File::ReadBackwards'->new($log))
1693 0 0 unless $_ = &decode_utf8(scalar $fh->readline)
1696 0 0 if (&any(sub { $_ eq $id; } , @ids))
1715 0 0 unless $_ = &decode_utf8(scalar $fh->readline)
1727 0 0 if @$log
1742 0 0 unless $_ = &decode_utf8(scalar $fh->readline)
1756 0 0 if @$log
1788 0 0 unless $ts and $id
1790 0 0 if ($revision eq "\x{1f5b9}") { }
0 0 elsif ($revision eq "\x{1f5bb}") { }
0 0 elsif ($revision > 0) { }
1791 0 0 if $seen{$name}
1798 0 0 if $seen{$name . "\034"}
1804 0 0 if $seen{$name}
1814 0 0 if $seen{$name . "\034"}
1825 0 0 if $ts gt $feed_ts
1873 0 0 if $ts gt $feed_ts
1914 0 0 if (not $style) { }
1919 0 0 if (not $style) { }
1922 0 0 unless $_
1923 0 0 unless $_
1928 0 0 unless $_
1929 0 0 unless $_
1959 0 0 unless $_
1960 0 0 unless $_
1977 0 0 if $diff->Same
1980 0 0 if ($diff->Diff == 3) { }
0 0 elsif ($diff->Diff == 2) { }
0 0 elsif ($diff->Diff == 1) { }
1982 0 0 $min1 == $max1 ? :
1984 0 0 $min2 == $max2 ? :
1987 0 0 $min2 == $max2 ? :
1990 0 0 $min1 == $max1 ? :
2007 0 0 if (my(@list) = $diff->Same) { }
2012 0 0 $_ ? :
2013 0 0 $_ ? :
2073 0 0 if (/^```(?:type=([a-z]+))?/u) { }
0 0 elsif ($code) { }
0 0 elsif (/^\* +(.*)/u) { }
0 0 elsif (my($url, $text) = /^=>\s*(\S+)\s*(.*)/u) { }
0 0 elsif (/^(#{1,6})\s*(.*)/u) { }
0 0 elsif (/^>\s*(.*)/u) { }
2075 0 0 if ($code) { }
2079 0 0 if $list
2087 0 0 unless $list
2091 0 0 unless $list
2096 0 0 if $list
2101 0 0 if $list
2105 0 0 if $list
2110 0 0 if $code
2111 0 0 if $list
2124 0 0 if $html =~ /\S/u
2155 0 0 if (not $style) { }
0 0 elsif ($style eq 'colour') { }
0 0 elsif ($style eq 'fancy') { }
2160 0 0 unless (-e $log)
2173 0 0 unless $_ = &decode_utf8(scalar $fh->readline)
2177 0 0 if $id_log ne $id
2178 0 0 unless changes($stream, $n, sub { $stream->write('## ' . (shift()) . "\n"); } , sub { $stream->write((shift()) . ' by ' . colourize($stream, shift(), $style) . "\n"); } , sub { print_link($stream, @_); } , sub { $stream->write(join("\n", @_, '')); } , sub { READ: return unless $_ = &decode_utf8(scalar $fh->readline); chomp $_; my($ts, $id_log, $revision, $code) = split(/\x1f/u, $_, 5); goto READ if $id_log ne $id; $ts, $id_log, $revision, $code, $host, $space, 0; } )
2180 0 0 $style ? :
2205 0 0 unless (-e $log)
2222 0 0 unless $_ = &decode_utf8(scalar $fh->readline)
2226 0 0 if $id_log ne $id
2228 0 0 unless $more
2266 0 0 if $revision and -f "$dir/keep/$id/$revision.gmi"
2267 0 0 if -f "$dir/page/$id.gmi"
2268 0 0 if $id eq 'robots' and not $space
2269 0 0 if $revision
2315 0 0 if (not -f $file) { }
0 0 elsif (not -f $meta) { }
2323 0 0 unless ($meta{'content-type'})
2341 0 0 if (not -f $file) { }
0 0 elsif (not -f $meta) { }
2355 0 0 unless ($meta{'content-type'})
2370 0 0 unless $str
2387 0 0 if (-e $file)
2389 0 0 if ($old eq $data)
2396 0 0 if (not open(my $fh, '>>:encoding(UTF-8)', $changes)) { }
2405 0 0 unless -d "$dir/file"
2407 0 0 if ($@)
2411 0 0 unless -d "$dir/meta"
2413 0 0 if ($@)
2430 0 0 if (not open(my $fh, '>>:encoding(UTF-8)', $changes)) { }
2455 0 0 if (keys %{$$server{'host'};} > 1)
2457 0 0 unless -d $dir
2459 0 0 if $space
2460 0 0 unless -d $dir
2470 0 0 if $space
2471 0 0 if (keys %{$$server{'host'};} > 1)
2472 0 0 unless $space
2473 0 0 if grep {$_ eq "$host/$space";} @{$$server{'wiki_space'};}
2486 0 0 if (keys %{$$server{'host'};} > 1) { }
2504 0 0 if (keys %{$$server{'host'};} > 1) { }
0 0 elsif (@{$App::Phoebe::server->{'wiki_space'};}) { }
2536 0 0 if (run_extensions($stream, $request, $headers, $buffer)) { }
0 0 elsif ($request =~ m[^GET /default.css HTTP/1\.[01]$]u and ($host) = $headers->{'host'} =~ /^($hosts)(?::$port)$/u) { }
0 0 elsif (($space) = $request =~ m[^GET (?:(?:/($spaces)/?)?|/) HTTP/1\.[01]$]u and ($host) = $headers->{'host'} =~ /^($hosts)(?::$port)$/u) { }
0 0 elsif (($space, $id, $n) = $request =~ m[^GET (?:/($spaces))?/page/([^/]*)(?:/(\d+))? HTTP/1\.[01]$]u and ($host) = $headers->{'host'} =~ /^($hosts)(?::$port)$/u) { }
0 0 elsif (($space, $id, $n) = $request =~ m[^GET (?:/($spaces))?/file/([^/]*)(?:/(\d+))? HTTP/1\.[01]$]u and ($host) = $headers->{'host'} =~ /^($hosts)(?::$port)$/u) { }
0 0 elsif (($space, $id, $n) = $request =~ m[^GET (?:/($spaces))?/history/([^/]*)(?:/(\d+))? HTTP/1\.[01]$]u and ($host) = $headers->{'host'} =~ /^($hosts)(?::$port)$/u) { }
0 0 elsif (($space, $id, $n) = $request =~ m[^GET (?:/($spaces))?/diff/([^/]*)(?:/(\d+))? HTTP/1\.[01]$]u and ($host) = $headers->{'host'} =~ /^($hosts)(?::$port)$/u) { }
0 0 elsif (($space, $id, $n) = $request =~ m[^GET (?:/($spaces))?/raw/([^/]*)(?:/(\d+))? HTTP/1\.[01]$]u and ($host) = $headers->{'host'} =~ /^($hosts)(?::$port)$/u) { }
0 0 elsif ($request =~ m[^GET /robots.txt(?:[#?].*)? HTTP/1\.[01]$]u and ($host) = $headers->{'host'} =~ /^($hosts)(?::$port)$/u) { }
0 0 elsif (($space, $id, $n) = $request =~ m[^GET (?:/($spaces))?/do/changes(?:/(\d+))? HTTP/1\.[01]$]u and ($host) = $headers->{'host'} =~ /^($hosts)(?::$port)$/u) { }
0 0 elsif (($filter, $n) = $request =~ m[^GET /do/all(?:/(latest))?/changes(?:/(\d+))? HTTP/1\.[01]$]u and ($host) = $headers->{'host'} =~ /^($hosts)(?::$port)$/u) { }
0 0 elsif (($space, $id, $n) = $request =~ m[^GET (?:/($spaces))?/do/index HTTP/1\.[01]$]u and ($host) = $headers->{'host'} =~ /^($hosts)(?::$port)$/u) { }
0 0 elsif (($space, $id, $n) = $request =~ m[^GET (?:/($spaces))?/do/files HTTP/1\.[01]$]u and ($host) = $headers->{'host'} =~ /^($hosts)(?::$port)$/u) { }
0 0 elsif (($space, $id, $n) = $request =~ m[^GET (?:/($spaces))?/do/spaces HTTP/1\.[01]$]u and ($host) = $headers->{'host'} =~ /^($hosts)(?::$port)$/u) { }
0 0 elsif (($space, $id, $n) = $request =~ m[^GET (?:/($spaces))?/do/rss HTTP/1\.[01]$]u and ($host) = $headers->{'host'} =~ /^($hosts)(?::$port)$/u) { }
0 0 elsif (($space, $id, $n) = $request =~ m[^GET (?:/($spaces))?/do/atom HTTP/1\.[01]$]u and ($host) = $headers->{'host'} =~ /^($hosts)(?::$port)$/u) { }
0 0 elsif (($space, $n) = $request =~ m[^GET /do/all/atom HTTP/1\.[01]$]u and ($host) = $headers->{'host'} =~ /^($hosts)(?::$port)$/u) { }
0 0 elsif ($request =~ m[^GET (?:/($spaces))?/do/source HTTP/1\.[01]$]u and ($host) = $headers->{'host'} =~ /^($hosts)(?::$port)$/u) { }
2600 0 0 if $@
2612 0 0 if ($request =~ m[^titan://($hosts)(?::$port)?]u)
2616 0 0 if ($path =~ m[^(?:/($spaces_regex))?(?:/raw)?/([^/;=&]+(?:;\w+=[^;=&]+)+)]u) { }
2620 0 0 if (valid_params($stream, $host, $space, $id, $params))
2643 0 0 unless valid_id($stream, $host, $space, $id, $params)
2644 0 0 unless valid_token($stream, $host, $space, $id, $params)
2645 0 0 unless valid_mime_type($stream, $host, $space, $id, $params)
2646 0 0 unless valid_size($stream, $host, $space, $id, $params)
2655 0 0 if (not $id) { }
0 0 elsif ($id =~ /[[:cntrl:]]/u) { }
2678 0 0 if $space and $App::Phoebe::server->{'wiki_space_token'}{$space}
2681 0 0 if (not $token and @tokens) { }
0 0 elsif (not grep(/^$token$/u, @tokens)) { }
2704 0 0 if (not $type) { }
0 0 elsif ($type ne 'text/plain' and not grep(/^$type$/u, @types) and not grep(/^$main_type$/u, @types)) { }
2725 0 0 if (not $size =~ /^\d+$/u) { }
0 0 elsif ($size > $App::Phoebe::server->{'wiki_page_size_limit'}) { }