Branch Coverage

blib/lib/Hypersonic.pm
Criterion Covered Total %
branch 212 408 51.9


line true false branch
34 0 48 if ($opts{'tls'})
35 0 0 unless $HAS_TLS
36 0 0 unless $opts{'cert_file'}
37 0 0 unless $opts{'key_file'}
38 0 0 unless -f $opts{'cert_file'}
39 0 0 unless -f $opts{'key_file'}
43 0 48 if ($opts{'http2'})
44 0 0 unless $opts{'tls'}
45 0 0 unless $HAS_HTTP2
94 0 48 $opts{'tls'} ? :
135 0 4 unless $path =~ m[^/]
136 0 4 unless ref $handler eq "CODE"
159 2 3 if ($path =~ /$pattern/)
165 1 0 if defined $captures[$i]
189 0 0 unless $url_prefix =~ m[^/]
190 0 0 unless -d $directory
269 0 0 unless ref $handler eq "CODE" or $is_builder
278 0 0 unless ref $handler eq "CODE" or $is_builder
354 0 0 unless (Hypersonic::Compress::check_zlib())
372 1 65 unless $path =~ m[^/]
373 1 64 unless ref $handler eq "CODE"
388 18 46 if (ref $opts eq "HASH")
389 11 7 $opts->{'dynamic'} ? :
392 9 0 $opts->{$feat} ? :
9 135 if exists $opts->{$feat}
402 5 75 if ($segments[$i] =~ /^:(\w+)$/)
409 7 57 if ($features{'streaming'})
414 0 64 if ($features{'need_xs_builder'})
439 1 22 unless @{$self->{'routes'};} or @{$self->{'static_dirs'} // [];}
440 1 21 if $self->{'compiled'}
445 0 21 if (my $static_dirs = $self->{'static_dirs'})
481 11 36 if ($route->{'dynamic'}) { }
484 3 8 if ($route->{'method'} =~ /^(POST|PUT|PATCH)$/)
493 0 11 if $f->{'parse_query'}
494 0 11 if $f->{'parse_headers'}
495 0 11 if $f->{'parse_cookies'}
496 1 10 if $f->{'parse_json'}
497 0 11 if $f->{'parse_form'}
498 0 11 if $f->{'response_helpers'}
499 2 9 if $f->{'streaming'}
500 0 11 if $f->{'need_xs_builder'}
504 11 0 if ($handler_code)
506 0 11 if $handler_code =~ /\{['"]*query['"]*\}/
507 0 11 if $handler_code =~ /\{['"]*headers['"]*\}/
508 0 11 if $handler_code =~ /\{['"]*cookies['"]*\}/
509 0 11 if $handler_code =~ /\{['"]*json['"]*\}/
510 0 11 if $handler_code =~ /\{['"]*form['"]*\}/
516 0 47 if (@{$route->{'params'};})
521 0 47 if (@{$route->{'before'};} or @{$route->{'after'};})
527 1 20 if ($self->{'_session_enabled'})
532 0 21 if ($self->{'_compression_enabled'})
540 0 21 if ($self->{'_async_enabled'})
541 0 0 if ($^O eq 'MSWin32') { }
553 0 1 if (builtin::blessed($mw) and $mw->can('build_before') || $mw->can('build_after')) { }
560 0 1 if (builtin::blessed($mw) and $mw->can('build_before') || $mw->can('build_after')) { }
583 0 0 unless $mw->can("slot_requirements")
586 0 0 if exists $middleware_slots{$name}
602 16 5 if (@methods == 1)
608 11 10 if (@paths > 1)
610 0 11 if (length $prefix > 1)
633 36 11 if (not $route->{'dynamic'}) { }
635 0 36 if ($route->{'_static_file'})
642 0 36 if ($route->{'need_xs_builder'})
655 1 35 if (ref $result eq 'ARRAY') { }
8 27 elsif (ref $result eq 'HASH') { }
669 1 35 unless defined $body and not ref $body
674 35 0 $self->{'enable_security_headers'} ? :
700 2 18 if ($self->{'route_analysis'}{'needs_streaming'})
703 2 2 unless $route->{'dynamic'}
704 2 0 $route->{'streaming'} ? :
710 0 20 if ($self->_has_websocket_routes)
717 0 0 if ($route->{'opts'}{'rooms'})
731 0 20 if ($self->{'websocket_rooms'})
737 0 20 if ($analysis->{'has_route_middleware'})
741 0 0 unless $route->{'dynamic'}
752 1 19 if ($analysis->{'has_global_before'} or $analysis->{'has_global_after'})
776 2 18 if ($self->{'route_analysis'}{'needs_streaming'})
782 0 20 if ($self->{'route_analysis'}{'needs_websocket'})
788 0 20 if ($self->{'route_analysis'}{'needs_websocket_handler'})
794 0 20 if ($self->{'route_analysis'}{'needs_websocket_rooms'})
800 0 20 if ($self->{'route_analysis'}{'needs_async_pool'})
810 0 20 if (my $xsr = $self->{'_xs_builder_routes'})
815 0 0 if ($result->{'xs_functions'})
829 0 20 if ($self->{'tls'})
835 0 20 if ($self->{'http2'})
844 0 20 if ($self->{'_compression_enabled'})
852 0 20 if ($self->{'route_analysis'}{'needs_async_pool'})
858 20 0 if ($self->{'_event_backend'})
860 20 0 if ($backend->can("extra_cflags"))
862 0 20 if $ev_cflags
865 20 0 if ($backend->can("extra_ldflags"))
867 0 20 if $ev_ldflags
875 0 20 if ($^O eq "MSWin32")
877 0 0 unless $ld =~ /-lws2_32\b/
884 0 20 unless $ok
897 0 20 unless defined &{"${module_name}::dispatch";}
902 0 20 if ($self->{'route_analysis'}{'needs_async_pool'})
973 0 20 if ($self->{'_compression_enabled'})
979 0 20 if ($self->{'tls'})
985 0 20 if ($self->{'http2'})
1004 4 16 if ($self->{'enable_security_headers'} and $has_dynamic)
1030 0 20 if (my $helpers = $self->{'c_helpers'})
1032 0 0 if (ref $helpers eq 'CODE') { }
1055 0 20 if ($self->{'_compression_enabled'})
1126 0 20 if ($self->{'tls'})
1139 0 20 if ($self->{'http2'})
1155 2 18 if ($analysis->{'needs_streaming'})
1169 0 20 if ($analysis->{'needs_websocket'})
1186 0 20 if ($analysis->{'needs_websocket_handler'})
1194 0 20 if ($analysis->{'needs_websocket_rooms'})
1203 0 20 if ($analysis->{'needs_async_pool'})
1217 0 20 if ($analysis->{'needs_xs_builder'})
1221 0 0 unless $route->{'need_xs_builder'}
1230 0 0 unless ref $result eq "HASH" and $result->{'xs_function'}
1243 0 0 if (@xs_builder_routes)
1257 0 20 if ($analysis->{'needs_websocket'})
1264 4 16 if ($has_dynamic)
1270 1 3 if ($analysis->{'has_any_middleware'})
1308 2 0 if ($analysis->{'needs_streaming'} and $self->{'_streaming_flags'})
1318 0 0 if ($analysis->{'needs_websocket'} and $self->{'_websocket_paths'})
1328 0 0 $i < $#paths ? :
1348 20 0 $self->{'enable_security_headers'} ? :
1360 4 16 if ($self->{'enable_security_headers'} and $has_dynamic)
1366 4 16 if ($has_dynamic)
1372 0 0 if ($analysis->{'needs_xs_builder'} and $self->{'_xs_builder_routes'} and @{$self->{'_xs_builder_routes'};})
1378 0 20 if ($analysis->{'needs_websocket'})
1406 35 11 if (not $r->{'dynamic'}) { }
1421 0 11 if ($r->{'need_xs_builder'} and $r->{'_xs_result'}) { }
0 11 elsif ($path =~ /:(\w+)/) { }
1425 0 0 if ($path =~ /:(\w+)/) { }
1619 4 16 if ($has_dynamic) { }
1632 1 3 if ($analysis->{'has_any_middleware'})
1637 1 0 if ($analysis->{'has_global_before'})
1644 1 0 if ($analysis->{'has_global_after'})
1653 0 1 if ($analysis->{'has_route_middleware'})
1674 0 20 if ($analysis->{'needs_websocket'})
1698 0 20 if ($self->{'tls'})
1719 0 20 if ($analysis->{'needs_async_pool'})
1728 0 20 if ($backend_name eq 'kqueue') { }
20 0 elsif ($backend_name eq 'epoll') { }
0 0 elsif ($backend_name eq 'io_uring') { }
1846 0 20 if ($analysis->{'needs_async_pool'})
1874 0 20 if ($analysis->{'needs_websocket'})
1889 0 20 if ($analysis->{'needs_websocket'})
1902 0 20 if ($analysis->{'needs_websocket'})
1915 4 16 if ($has_dynamic) { }
1917 0 4 if ($analysis->{'needs_xs_builder'} and $self->{'_xs_builder_routes'} and @{$self->{'_xs_builder_routes'};}) { }
1965 0 20 if ($analysis->{'needs_websocket'})
1979 0 20 if ($analysis->{'needs_async_pool'})
1997 0 0 unless @$xs_routes
2095 0 4 if ($analysis->{'needs_query'} or $analysis->{'needs_form'})
2155 0 3 if ($analysis->{'needs_headers'} or $analysis->{'needs_cookies'} or $analysis->{'needs_json'} or $analysis->{'needs_form'})
2192 0 4 if ($analysis->{'has_builder_before'} or $analysis->{'has_builder_after'})
2197 0 0 if $seen_classes{$class}++
2198 0 0 if ($mw->can("build_helpers"))
2206 1 3 if ($analysis->{'has_any_middleware'})
2331 0 4 if ($analysis->{'needs_query'}) { }
2355 1 3 if ($needs_header_parse) { }
2363 1 0 if ($analysis->{'needs_cookies'}) { }
2398 1 0 if ($analysis->{'needs_form'} or $analysis->{'needs_json'}) { }
2405 0 1 if ($analysis->{'needs_form'}) { }
2417 1 0 if ($analysis->{'needs_json'}) { }
2471 0 4 if ($analysis->{'has_builder_before'})
2480 0 0 if ($mw->can("build_before"))
2487 1 3 if ($analysis->{'has_global_before'})
2501 0 4 if ($analysis->{'has_route_middleware'})
2521 2 2 if ($analysis->{'needs_streaming'})
2544 1 3 if ($analysis->{'has_any_middleware'}) { }
2552 0 1 if ($analysis->{'needs_streaming'})
2567 2 1 if ($analysis->{'needs_streaming'})
2577 0 4 if ($analysis->{'has_route_middleware'})
2596 1 3 if ($analysis->{'has_global_after'})
2609 0 4 if ($analysis->{'has_builder_after'})
2619 0 0 if ($mw->can("build_after"))
2626 2 2 if ($analysis->{'needs_streaming'})
2653 1 3 if ($analysis->{'has_any_middleware'}) { }
2714 0 4 if ($self->{'_compression_enabled'})
2827 1 3 if ($analysis->{'has_any_middleware'}) { }
3097 0 11 unless ref $coderef eq "CODE"
3100 4 7 unless $DEPARSER
3104 0 11 $@ ? :
3110 0 11 unless @paths
3111 0 11 if @paths == 1
3117 0 56 if $prefix eq ""
3122 3 8 if (not $prefix =~ m[/$] and $prefix =~ m[^(.*/)[^/]+$])
3187 0 0 unless -f $_
3197 0 0 unless open my $fh, "<:raw", $file_path
3207 0 0 if ($gen_etag)
3241 0 0 if $max_age
3242 0 0 if $etag
3245 0 0 if ($self->{'enable_security_headers'})
3277 177 236 unless defined $value and length $value
3287 0 4 unless $self->{'enable_security_headers'}
3290 0 4 unless length $headers
3299 1 30 unless $self->{'compiled'}
3306 1 6 unless $self->{'compiled'}
3317 0 6 if ($^O eq "MSWin32" and $workers > 1)
3323 0 6 $self->{'tls'} ? :
0 6 $self->{'http2'} ? :
3329 0 6 if ($workers > 1)
3332 0 0 unless (defined $pid)
3335 0 0 if ($pid == 0)
3338 0 0 if $listen_fd < 0
3347 0 6 if $listen_fd < 0