Branch Coverage

blib/lib/Hypersonic.pm
Criterion Covered Total %
branch 213 410 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/
885 20 0 if ($ENV{'HYPERSONIC_COMPILE_DIAG'} or $ENV{'AUTOMATED_TESTING'})
904 0 20 unless $ok
917 0 20 unless defined &{"${module_name}::dispatch";}
922 0 20 if ($self->{'route_analysis'}{'needs_async_pool'})
993 0 20 if ($self->{'_compression_enabled'})
999 0 20 if ($self->{'tls'})
1005 0 20 if ($self->{'http2'})
1024 4 16 if ($self->{'enable_security_headers'} and $has_dynamic)
1050 0 20 if (my $helpers = $self->{'c_helpers'})
1052 0 0 if (ref $helpers eq 'CODE') { }
1075 0 20 if ($self->{'_compression_enabled'})
1146 0 20 if ($self->{'tls'})
1159 0 20 if ($self->{'http2'})
1175 2 18 if ($analysis->{'needs_streaming'})
1189 0 20 if ($analysis->{'needs_websocket'})
1206 0 20 if ($analysis->{'needs_websocket_handler'})
1214 0 20 if ($analysis->{'needs_websocket_rooms'})
1223 0 20 if ($analysis->{'needs_async_pool'})
1237 0 20 if ($analysis->{'needs_xs_builder'})
1241 0 0 unless $route->{'need_xs_builder'}
1250 0 0 unless ref $result eq "HASH" and $result->{'xs_function'}
1263 0 0 if (@xs_builder_routes)
1277 0 20 if ($analysis->{'needs_websocket'})
1284 4 16 if ($has_dynamic)
1290 1 3 if ($analysis->{'has_any_middleware'})
1328 2 0 if ($analysis->{'needs_streaming'} and $self->{'_streaming_flags'})
1338 0 0 if ($analysis->{'needs_websocket'} and $self->{'_websocket_paths'})
1348 0 0 $i < $#paths ? :
1368 20 0 $self->{'enable_security_headers'} ? :
1380 4 16 if ($self->{'enable_security_headers'} and $has_dynamic)
1386 4 16 if ($has_dynamic)
1392 0 0 if ($analysis->{'needs_xs_builder'} and $self->{'_xs_builder_routes'} and @{$self->{'_xs_builder_routes'};})
1398 0 20 if ($analysis->{'needs_websocket'})
1426 35 11 if (not $r->{'dynamic'}) { }
1441 0 11 if ($r->{'need_xs_builder'} and $r->{'_xs_result'}) { }
0 11 elsif ($path =~ /:(\w+)/) { }
1445 0 0 if ($path =~ /:(\w+)/) { }
1639 4 16 if ($has_dynamic) { }
1652 1 3 if ($analysis->{'has_any_middleware'})
1657 1 0 if ($analysis->{'has_global_before'})
1664 1 0 if ($analysis->{'has_global_after'})
1673 0 1 if ($analysis->{'has_route_middleware'})
1694 0 20 if ($analysis->{'needs_websocket'})
1718 0 20 if ($self->{'tls'})
1739 0 20 if ($analysis->{'needs_async_pool'})
1748 0 20 if ($backend_name eq 'kqueue') { }
20 0 elsif ($backend_name eq 'epoll') { }
0 0 elsif ($backend_name eq 'io_uring') { }
1866 0 20 if ($analysis->{'needs_async_pool'})
1894 0 20 if ($analysis->{'needs_websocket'})
1909 0 20 if ($analysis->{'needs_websocket'})
1922 0 20 if ($analysis->{'needs_websocket'})
1935 4 16 if ($has_dynamic) { }
1937 0 4 if ($analysis->{'needs_xs_builder'} and $self->{'_xs_builder_routes'} and @{$self->{'_xs_builder_routes'};}) { }
1985 0 20 if ($analysis->{'needs_websocket'})
1999 0 20 if ($analysis->{'needs_async_pool'})
2017 0 0 unless @$xs_routes
2115 0 4 if ($analysis->{'needs_query'} or $analysis->{'needs_form'})
2175 0 3 if ($analysis->{'needs_headers'} or $analysis->{'needs_cookies'} or $analysis->{'needs_json'} or $analysis->{'needs_form'})
2212 0 4 if ($analysis->{'has_builder_before'} or $analysis->{'has_builder_after'})
2217 0 0 if $seen_classes{$class}++
2218 0 0 if ($mw->can("build_helpers"))
2226 1 3 if ($analysis->{'has_any_middleware'})
2351 0 4 if ($analysis->{'needs_query'}) { }
2375 1 3 if ($needs_header_parse) { }
2383 1 0 if ($analysis->{'needs_cookies'}) { }
2418 1 0 if ($analysis->{'needs_form'} or $analysis->{'needs_json'}) { }
2425 0 1 if ($analysis->{'needs_form'}) { }
2437 1 0 if ($analysis->{'needs_json'}) { }
2491 0 4 if ($analysis->{'has_builder_before'})
2500 0 0 if ($mw->can("build_before"))
2507 1 3 if ($analysis->{'has_global_before'})
2521 0 4 if ($analysis->{'has_route_middleware'})
2541 2 2 if ($analysis->{'needs_streaming'})
2564 1 3 if ($analysis->{'has_any_middleware'}) { }
2572 0 1 if ($analysis->{'needs_streaming'})
2587 2 1 if ($analysis->{'needs_streaming'})
2597 0 4 if ($analysis->{'has_route_middleware'})
2616 1 3 if ($analysis->{'has_global_after'})
2629 0 4 if ($analysis->{'has_builder_after'})
2639 0 0 if ($mw->can("build_after"))
2646 2 2 if ($analysis->{'needs_streaming'})
2673 1 3 if ($analysis->{'has_any_middleware'}) { }
2734 0 4 if ($self->{'_compression_enabled'})
2847 1 3 if ($analysis->{'has_any_middleware'}) { }
3117 0 11 unless ref $coderef eq "CODE"
3120 4 7 unless $DEPARSER
3124 0 11 $@ ? :
3130 0 11 unless @paths
3131 0 11 if @paths == 1
3137 0 56 if $prefix eq ""
3142 3 8 if (not $prefix =~ m[/$] and $prefix =~ m[^(.*/)[^/]+$])
3207 0 0 unless -f $_
3217 0 0 unless open my $fh, "<:raw", $file_path
3227 0 0 if ($gen_etag)
3261 0 0 if $max_age
3262 0 0 if $etag
3265 0 0 if ($self->{'enable_security_headers'})
3297 177 236 unless defined $value and length $value
3307 0 4 unless $self->{'enable_security_headers'}
3310 0 4 unless length $headers
3319 1 30 unless $self->{'compiled'}
3326 1 6 unless $self->{'compiled'}
3337 0 6 if ($^O eq "MSWin32" and $workers > 1)
3343 0 6 $self->{'tls'} ? :
0 6 $self->{'http2'} ? :
3349 0 6 if ($workers > 1)
3352 0 0 unless (defined $pid)
3355 0 0 if ($pid == 0)
3358 0 0 if $listen_fd < 0
3367 0 6 if $listen_fd < 0