| 1 | package YATT::Lite::WebMVC0::SiteApp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 69 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 69 | ▶ | use warnings qw(FATAL all NONFATAL misc); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 69 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 69 | ▶ | use YATT::Lite::Breakpoint; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | sub MY () {__PACKAGE__} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 69 | ▶ | use mro 'c3'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 69 | ▶ | use 5.010; no if $] >= 5.017011, warnings => "experimental"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 69 | ▶ | use constant DEBUG_ERROR => $ENV{DEBUG_YATT_ERROR}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | # Dispatcher Layer: load and run corresponding DirApp for incoming request. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 69 | ▶ | use parent qw(YATT::Lite::Factory); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 69 | ▶ | use YATT::Lite::MFields qw/noheader | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | is_psgi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | no_nested_query | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | mkquery_with_body_params | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | _allow_debug_from | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | _trusted_proxies | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | debug_cgi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | debug_psgi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | debug_connection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | debug_backend | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | psgi_static | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | psgi_fallback | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | per_role_docroot | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | per_role_docroot_key | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | default_role | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | backend | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | site_config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | _site_config_cache_entry | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | site_config_as_entity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | logfile | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | overwrite_status_code_for_errors_as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | _re_handled_ext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | _handled_ext_list | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | ^progname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | no_trim_script_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | ext_public_action | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | ^config_dir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | _dirapp_config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | use_sibling_config_dir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 69 | /; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 69 | ▶ | use YATT::Lite::Util qw(cached_in split_path catch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | lookup_path nonempty try_invoke | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | trim_ext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | mk_http_status | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | default ckrequire | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | escape | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | trim_common_suffix_from | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | is_done | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | lexpand rootname extname untaint_any terse_dump | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | add_entity_into | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 69 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 69 | ▶ | use YATT::Lite::Util::CmdLine qw(parse_params); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 69 | ▶ | use YATT::Lite qw/Entity *SYS *CON/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 69 | our @EXPORT_OK = qw/*CON/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 69 | ▶ | use YATT::Lite::WebMVC0::DirApp (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | sub DirApp () {'YATT::Lite::WebMVC0::DirApp'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | sub default_default_app () {'YATT::Lite::WebMVC0::DirApp'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 192 | ▶ | sub default_ext_public_action {'ydo'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_ext_public_action: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 69 | ▶ | use File::Basename; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 69 | ▶ | use URI; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 192 | ▶ | sub after_new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
after_new: called CC=8 SCAR=23.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 192 | (my MY $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 192 | $self->SUPER::after_new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 192 | ▶ | $self->{ext_public_action} //= $self->default_ext_public_action; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"ext_public_action"} //= $self->default_ext_public_action
MC/DC0%0/2
$self->{"ext_public_action"} //= $self->default_ext_public_action
$self->{"ext_public_action"}
$self->default_ext_public_action
Truth table33%1/3
A //= B
A= $self->{"ext_public_action"}B= $self->default_ext_public_action
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | $self->{_handled_ext_list} = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | $self->{ext_public}, $self->{ext_public_action} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 192 | ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 192 | $self->{_re_handled_ext} = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 192 | my $str = join("|", @{$self->{_handled_ext_list}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 192 | qr{\.($str)$}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 192 | ▶ | $self->{per_role_docroot_key} ||= $self->default_per_role_docroot_key; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"per_role_docroot_key"} ||= $self->default_per_role_docroot_key
MC/DC0%0/2
$self->{"per_role_docroot_key"} ||= $self->default_per_role_docroot_key
$self->{"per_role_docroot_key"}
$self->default_per_role_docroot_key
Truth table33%1/3
A ||= B
A= $self->{"per_role_docroot_key"}B= $self->default_per_role_docroot_key
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 192 | ▶ | $self->{default_role} ||= $self->default_default_role; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"default_role"} ||= $self->default_default_role
MC/DC0%0/2
$self->{"default_role"} ||= $self->default_default_role
$self->{"default_role"}
$self->default_default_role
Truth table33%1/3
A ||= B
A= $self->{"default_role"}B= $self->default_default_role
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 192 | ▶ | $self->{config_dir} //= do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"config_dir"} //= do {
if (not $self->{"app_root"}) {
undef;
}
elsif ($self->{"use_sibling_config_dir"}) {
qq[$self->{"app_root"}.config.d];
}
else {
qq[$self->{"app_root"}/config];
}
}
MC/DC0%0/2
$self->{"config_dir"} //= do {
if (not $self->{"app_root"}) {
undef;
}
elsif ($self->{"use_sibling_config_dir"}) {
qq[$self->{"app_root"}.config.d];
}
else {
qq[$self->{"app_root"}/config];
}
}
$self->{"config_dir"}
do {
if (not $self->{"app_root"}) {
undef;
}
elsif ($self->{"use_sibling_config_dir"}) {
qq[$self->{"app_root"}.config.d];
}
else {
qq[$self->{"app_root"}/config];
}
}
Truth table33%1/3
A //= B
A= $self->{"config_dir"}B= do {
if (not $self->{"app_root"}) {
undef;
}
elsif ($self->{"use_sibling_config_dir"}) {
qq[$self->{"app_root"}.config.d];
}
else {
qq[$self->{"app_root"}/config];
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 192 | ▶ | if (not $self->{app_root}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } elsif ($self->{use_sibling_config_dir}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 3 | "$self->{app_root}.config.d" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 189 | "$self->{app_root}/config" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 192 | $self->{_dirapp_config} = +{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 192 | ▶ | $self->{site_config_as_entity} //= $self->default_site_config_as_entity; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"site_config_as_entity"} //= $self->default_site_config_as_entity
MC/DC0%0/2
$self->{"site_config_as_entity"} //= $self->default_site_config_as_entity
$self->{"site_config_as_entity"}
$self->default_site_config_as_entity
Truth table33%1/3
A //= B
A= $self->{"site_config_as_entity"}B= $self->default_site_config_as_entity
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 192 | ▶ | sub default_per_role_docroot_key { 'yatt.role' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_per_role_docroot_key: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 192 | ▶ | sub default_default_role { 'nobody' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_default_role: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 192 | ▶ | sub default_site_config_as_entity {1} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_site_config_as_entity: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 244 | ▶ | sub _cf_delegates { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cf_delegates: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | (shift->SUPER::_cf_delegates | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 244 | , qw(overwrite_status_code_for_errors_as)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | # runas($type, $fh, \%ENV, \@ARGV) ... for CGI/FCGI support. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 16 | ▶ | sub runas { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
runas: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 16 | (my $this, my $type) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 16 | ▶ | my MY $self = ref $this ? $this : $this->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 16 | ▶ | my $sub = $self->can("runas_$type") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | or die "\n\nUnknown runas type: $type"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 16 | $sub->($self, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 16 | ▶ | sub runas_cgi { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
runas_cgi: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 16 | require YATT::Lite::WebMVC0::SiteApp::CGI; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 16 | shift->_runas_cgi(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | sub runas_fcgi { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
runas_fcgi: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | require YATT::Lite::WebMVC0::SiteApp::FCGI; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | shift->_runas_fcgi(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | # callas($type, $app, $fh, \%ENV, \@ARGV, %opts) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | sub callas { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
callas: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | (my $this, my $type) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | my MY $self = ref $this ? $this : $this->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | my $sub = $self->can("callas_$type") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | or die "\n\nUnknown callas type: $type"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | $sub->($self, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | sub callas_cgi { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
callas_cgi: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | require YATT::Lite::WebMVC0::SiteApp::CGI; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | shift->_callas_cgi(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | sub callas_fcgi { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
callas_fcgi: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | require YATT::Lite::WebMVC0::SiteApp::FCGI; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | shift->_callas_fcgi(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | # Dispatcher::get_dirhandler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | # -> Util::cached_in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | # -> Factory::load | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | # -> Factory::buildspec | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 748 | ▶ | sub get_lochandler { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_lochandler: called CC=3 SCAR=15.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 748 | (my MY $self, my ($location, $tmpldir)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 748 | ▶ | if ($self->{per_role_docroot}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | # When per_role_docroot is on, $tmpldir already points | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | # $per_role_docroot/$role. So just append $location. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | # Unfortunately, $self->error_response calls get_lochandler without $tmpldir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | $tmpldir //= "$self->{per_role_docroot}/$self->{default_role}"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$tmpldir //= qq[$self->{"per_role_docroot"}/$self->{"default_role"}]
MC/DC0%0/1
$tmpldir //= qq[$self->{"per_role_docroot"}/$self->{"default_role"}]
$tmpldir
Truth table0%0/2
A
A= $tmpldir
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | $self->get_dirhandler($tmpldir.$location); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 748 | $self->SUPER::get_lochandler($location, $tmpldir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | #---------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | # preload_handlers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 1 | ▶ | sub preload_apps { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
preload_apps: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 1 | (my MY $self, my (@dir)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | ▶ | push @dir, $self->{doc_root} unless @dir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 1 | my @apps; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 1 | foreach my $dir ($self->find_apps(@dir)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 4 | push @apps, my $app = $self->get_dirhandler($dir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 1 | @apps; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 1 | ▶ | sub find_apps { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_apps: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 1 | (my MY $self, my @dir) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 1 | require File::Find; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 1 | my @apps; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 17 | ▶ | my $handler = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 17 | ▶ | push @apps, $_ if -d; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 1 | File::Find::find({wanted => $handler | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | , no_chdir => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | , follow_skip => 2} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | , @dir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 1 | @apps; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | # PSGI Adaptor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 69 | ▶ | use YATT::Lite::PSGIEnv qw/SCRIPT_URL/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 86 | ▶ | sub to_app { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to_app: called CC=3 SCAR=13.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 86 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | # XXX: Should check it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | # unless (defined $self->{app_root}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | # croak "app_root is undef!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 86 | ▶ | unless (defined $self->{doc_root} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $self->{"doc_root"} or defined $self->{"per_role_docroot"}
MC/DC0%0/2
defined $self->{"doc_root"} or defined $self->{"per_role_docroot"}
defined $self->{"doc_root"}
defined $self->{"per_role_docroot"}
Truth table33%1/3
A or B
A= defined $self->{"doc_root"}B= defined $self->{"per_role_docroot"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | or defined $self->{per_role_docroot}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | croak "document_root is undef!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 86 | return $self->SUPER::to_app(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 88 | ▶ | sub prepare_app { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare_app: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 88 | (my MY $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 88 | $self->next::method; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 88 | $self->{is_psgi} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 88 | require Plack::Request; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 88 | require Plack::Response; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 88 | require Plack::Util; # for response_cb in call(). Do not rely on plackup. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 88 | my $backend; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 88 | ▶ | if ($backend = $self->{backend} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$backend = $self->{"backend"} and my $sub = $backend->can("startup")
MC/DC50%1/2
$backend = $self->{"backend"} and my $sub = $backend->can("startup")
$backend = $self->{"backend"}
my $sub = $backend->can("startup")
Truth table66%2/3
A and B
A= $backend = $self->{"backend"}B= my $sub = $backend->can("startup")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | and my $sub = $backend->can('startup')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 1 | $sub->($backend, $self, $self->preload_apps); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 491 | ▶ | sub call { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
call: called CC=38 SCAR=47.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 491 | (my MY $self, my Env $env) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 491 | YATT::Lite::Breakpoint::break_psgi_call(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 491 | ▶ | if ($self->has_htdebug("env")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | return $self->psgi_dump(map {"$_\t".($env->{$_}//"(undef)")."\n"} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$env->{$_} // "(undef)"
MC/DC0%0/1
$env->{$_} // "(undef)"
$env->{$_}
Truth table0%0/2
A
A= $env->{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | sort keys %$env); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 491 | ▶ | if (my $deny = $self->has_forbidden_path($env->{PATH_INFO}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->has_forbidden_path($env->{"PATH_INFO"}) // $self->has_forbidden_path($env->{"PATH_TRANSLATED"})
MC/DC50%1/2
$self->has_forbidden_path($env->{"PATH_INFO"}) // $self->has_forbidden_path($env->{"PATH_TRANSLATED"})
$self->has_forbidden_path($env->{"PATH_INFO"})
$self->has_forbidden_path($env->{"PATH_TRANSLATED"})
Truth table66%2/3
A // B
A= $self->has_forbidden_path($env->{"PATH_INFO"})B= $self->has_forbidden_path($env->{"PATH_TRANSLATED"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | // $self->has_forbidden_path($env->{PATH_TRANSLATED})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 3 | return $self->psgi_error(403, "Forbidden $deny"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 488 | ▶ | if (not $self->{no_unicode_params} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $self->{"no_unicode_params"} and $self->{"output_encoding"}
MC/DC0%0/2
not $self->{"no_unicode_params"} and $self->{"output_encoding"}
not $self->{"no_unicode_params"}
$self->{"output_encoding"}
Truth table33%1/3
not(A) and B
A= not $self->{"no_unicode_params"}B= $self->{"output_encoding"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | and $self->{output_encoding}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | $env->{PATH_INFO} = Encode::decode($self->{output_encoding} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 488 | , $env->{PATH_INFO}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 488 | ▶ | if ($self->{_loc2psgi_dict} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->{"_loc2psgi_dict"} and () = $self->lookup_psgi_mount($env->{"PATH_INFO"})
MC/DC100%2/2
$self->{"_loc2psgi_dict"} and () = $self->lookup_psgi_mount($env->{"PATH_INFO"})
$self->{"_loc2psgi_dict"}
() = $self->lookup_psgi_mount($env->{"PATH_INFO"})
Truth table100%3/3
A and B
A= $self->{"_loc2psgi_dict"}B= () = $self->lookup_psgi_mount($env->{"PATH_INFO"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | and my ($path_prefix, $psgi_app) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | = $self->lookup_psgi_mount($env->{PATH_INFO})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 7 | require Plack::Util; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 7 | local $env->{PATH_INFO} = $self->trimleft_length($env->{PATH_INFO}, $path_prefix); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 7 | local $env->{SCRIPT_NAME} = $self->trimleft_length($env->{SCRIPT_NAME}, $path_prefix); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 7 | return Plack::Util::run_app($psgi_app, $env); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | # XXX: user_dir? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 481 | my ($tmpldir, $loc, $file, $trailer, $is_index, $request_file) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | = my @pi = $self->split_path_info($env); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 481 | ▶ | if (@pi and $loc =~ m{/\.\./}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@pi and $loc =~ m[/\.\./]
MC/DC0%0/2
@pi and $loc =~ m[/\.\./]
@pi
$loc =~ m[/\.\./]
Truth table66%2/3
A and B
A= @piB= $loc =~ m[/\.\./]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | return $self->psgi_error(403, "Bad location: $loc"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | # Set $env->{yatt.script_name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 481 | $self->set_yatt_script_name($env); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 481 | my ($realdir, $virtdir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 481 | ▶ | if (@pi) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 478 | $realdir = "$tmpldir$loc"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | $virtdir = defined $self->{doc_root} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 478 | ▶ | ? "$self->{doc_root}$loc" : $realdir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 481 | ▶ | if ($self->has_htdebug("path_info")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | return $self->psgi_dump([tmpldir => $tmpldir] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | , [loc => $loc] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | , [file => $file] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | , [trailer => $trailer] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | , [virtdir => $virtdir, realdir => $realdir] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 481 | ▶ | if ($self->{debug_psgi}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | # XXX: should be configurable. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | ▶ | if (my $errfh = fileno(STDERR) ? \*STDERR : $env->{'psgi.errors'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | print $errfh join("\t" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | , "# REQ: " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | , terse_dump([tmpldir => $tmpldir] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | , [loc => $loc] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | , [file => $file] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | , [trailer => $trailer] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | , ['all templdirs', $self->{_tmpldirs}] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | , map {[$_ => $env->{$_}]} sort keys %$env) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | ), "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 481 | ▶ | unless (@pi) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 3 | return $self->psgi_handle_fallback($env); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 478 | ▶ | unless (-d $realdir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | return $self->psgi_error(404, "Not found: $loc"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | # Default index file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | # Note: Files may placed under (one of) tmpldirs instead of docroot. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 478 | ▶ | if ($file eq '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | $file = "$self->{index_name}.$self->{ext_public}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | } elsif ($file eq $self->{index_name}) { #XXX: $is_index | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | $file .= ".$self->{ext_public}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 478 | ▶ | if ($file !~ $self->{_re_handled_ext}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 1 | ▶ | if ($self->{debug_psgi} and $self->has_htdebug("static")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"debug_psgi"} and $self->has_htdebug("static")
MC/DC0%0/2
$self->{"debug_psgi"} and $self->has_htdebug("static")
$self->{"debug_psgi"}
$self->has_htdebug("static")
Truth table33%1/3
A and B
A= $self->{"debug_psgi"}B= $self->has_htdebug("static")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | return $self->psgi_dump("Not handled since extension doesn't match" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | , $file, $self->{_re_handled_ext}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 1 | return $self->psgi_handle_static($env); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 477 | ▶ | my $dh = $self->get_lochandler(map {untaint_any($_)} $loc, $tmpldir) or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | return $self->psgi_error(404, "No such directory: $loc"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | # To support $con->param and other cgi compat methods. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 477 | my $req = Plack::Request->new($env); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 477 | ▶ | $request_file //= $is_index ? '' : trim_ext($file, $self->{ext_public}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$request_file //= $is_index ? "" : trim_ext($file, $self->{"ext_public"})
MC/DC0%0/2
$request_file //= $is_index ? "" : trim_ext($file, $self->{"ext_public"})
$request_file
$is_index ? "" : trim_ext($file, $self->{"ext_public"})
Truth table33%1/3
A //= B
A= $request_fileB= $is_index ? "" : trim_ext($file, $self->{"ext_public"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | my @params = (env => $env | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | , path_info => $env->{PATH_INFO} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 477 | ▶ | , $self->connection_quad([$virtdir, $loc, $file, $trailer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | , $request_file]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | , $is_index ? (is_index => 1) : () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | , is_psgi => 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 477 | local $CON = my $con = $self->make_connection(undef, @params, yatt => $dh, noheader => 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 477 | ▶ | my $error = catch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 477 | $CON->configure(cgi => $req); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 460 | $self->run_dirhandler($dh, $con, $file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 477 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 477 | try_invoke($con, 'flush_headers'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 477 | ▶ | if ($self->has_htdebug("response")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | return [200, [], [terse_dump(["caught exception" => $error]) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | , "\n", terse_dump(["diag(inner to outer)" => $CON->diag_list]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | , "\n", terse_dump(["buffers(inner to outer)" => $CON->oldbuf, $CON->buffer]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 477 | ▶ | if ($con->is_error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 107 | print STDERR "# EARLY ERROR\n" if DEBUG_ERROR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 107 | my $error_list = $con->error_list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 107 | return $self->error_response($error_list->[0], $env, $con); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | ▶ | elsif (not $error or is_done($error)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
not $error or is_done($error)
MC/DC50%1/2
not $error or is_done($error)
not $error
is_done($error)
Truth table66%2/3
not(A) or B
A= not $errorB= is_done($error)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 329 | print STDERR "# NORMAL\n" if DEBUG_ERROR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 329 | return $self->psgi_response_of_connection($con, $env); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | ▶ | } elsif (ref $error eq 'ARRAY' or ref $error eq 'CODE') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
ref $error eq "ARRAY" or ref $error eq "CODE"
MC/DC0%0/2
ref $error eq "ARRAY" or ref $error eq "CODE"
ref $error eq "ARRAY"
ref $error eq "CODE"
Truth table66%2/3
A or B
A= ref $error eq "ARRAY"B= ref $error eq "CODE"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 41 | print STDERR "# SPECIAL\n" if DEBUG_ERROR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | # redirect | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 41 | ▶ | if ($self->{debug_psgi}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | ▶ | if (my $errfh = fileno(STDERR) ? \*STDERR : $env->{'psgi.errors'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | print $errfh "PSGI Response: ", terse_dump($error), "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 41 | ▶ | return Plack::Util::response_cb($error, sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 41 | my $res = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 41 | $self->finalize_response($env, $res); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 41 | $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 41 | }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | } elsif (UNIVERSAL::isa($error, 'YATT::Lite::Error')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | print STDERR "# ERROR\n" if DEBUG_ERROR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | return $self->error_response($error, $env, $con); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | print STDERR "# from raw die\n" if DEBUG_ERROR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | # system_error. Should be treated by PSGI Server. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | die $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 108 | ▶ | sub error_response { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
error_response: called CC=6 SCAR=18.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 108 | (my MY $self, my $err, my Env $env, my $orig_con) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | my $error_status = $self->{overwrite_status_code_for_errors_as} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | // $err->{http_status_code} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 108 | ▶ | // $orig_con->cget('status') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition75%6/8
(($self->{"overwrite_status_code_for_errors_as"} // $err->{"http_status_code"}) // $orig_con->cget("status")) // 500
($self->{"overwrite_status_code_for_errors_as"} // $err->{"http_status_code"}) // $orig_con->cget("status")
$self->{"overwrite_status_code_for_errors_as"} // $err->{"http_status_code"}
MC/DC33%1/3
(($self->{"overwrite_status_code_for_errors_as"} // $err->{"http_status_code"}) // $orig_con->cget("status")) // 500
$self->{"overwrite_status_code_for_errors_as"}
$err->{"http_status_code"}
$orig_con->cget("status")
Truth table50%2/4
A // B // C
A= $self->{"overwrite_status_code_for_errors_as"}B= $err->{"http_status_code"}C= $orig_con->cget("status")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | // 500; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 108 | my $root = $self->get_lochandler('/'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 108 | ▶ | if (my ($sub, $pkg) = $root->find_renderer(error => ignore_error => 1)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 16 | my $errcon = $orig_con->as_error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 16 | local ($SYS, $CON) = ($self, $errcon); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 16 | $sub->($pkg, $errcon, $err); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 16 | $self->psgi_response_of_connection($errcon, $env); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 92 | ▶ | return $self->psgi_text($err->cget('http_status_code') // 500 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$err->cget("http_status_code") // 500
MC/DC100%1/1
$err->cget("http_status_code") // 500
$err->cget("http_status_code")
Truth table100%2/2
A
A= $err->cget("http_status_code")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | , $err->byte_message); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 345 | ▶ | sub psgi_response_of_connection { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
psgi_response_of_connection: called CC=6 SCAR=18.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 345 | (my MY $self, my $con, my Env $env) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 345 | ▶ | $env //= $con->cget('env'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$env //= $con->cget("env")
MC/DC0%0/2
$env //= $con->cget("env")
$env
$con->cget("env")
Truth table33%1/3
A //= B
A= $envB= $con->cget("env")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 345 | ▶ | my $code = $con->cget('status') // $env->{REDIRECT_STATUS} // 200; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%5/5
($con->cget("status") // $env->{"REDIRECT_STATUS"}) // 200
$con->cget("status") // $env->{"REDIRECT_STATUS"}
MC/DC100%2/2
($con->cget("status") // $env->{"REDIRECT_STATUS"}) // 200
$con->cget("status")
$env->{"REDIRECT_STATUS"}
Truth table100%3/3
A // B
A= $con->cget("status")B= $env->{"REDIRECT_STATUS"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 345 | my $res = Plack::Response->new($code); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | $res->content_type("text/html" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | . ($self->{header_charset} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 345 | ▶ | ? qq{; charset="$self->{header_charset}"} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | : "")); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 345 | ▶ | if (my @h = $con->list_header) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 8 | $res->headers->header(@h); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 345 | $res->body($con->buffer); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 345 | my $tuple = $res->finalize; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 345 | $self->finalize_response($env, $tuple); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 345 | return $tuple; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 610 | ▶ | sub before_dirhandler { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
before_dirhandler: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 610 | (my MY $self, my ($dh, $con, $file)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 610 | ▶ | if ($self->{site_config_as_entity}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 610 | $self->examine_site_config($con); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 610 | &maybe::next::method; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 131 | ▶ | sub make_debug_params { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_debug_params: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 131 | (my MY $self, my ($reqrec, $args)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 131 | ▶ | my ($path_info, @rest) = ref $reqrec ? @$reqrec : $reqrec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 131 | my Env $env = Env->psgi_simple_env; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 131 | $env->{PATH_INFO} = $path_info; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 131 | $env->{REQUEST_URI} = $path_info; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 131 | my @params = ($self->SUPER::make_debug_params($reqrec, $args) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | , env => $env); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 131 | require Plack::Request; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 131 | push @params, cgi => Plack::Request->new($env) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | , parameters => YATT::Lite::Util::ixhash(lexpand($args)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | , is_psgi => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 131 | @params; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 1 | ▶ | sub psgi_handle_static { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
psgi_handle_static: called CC=2 SCAR=7.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 1 | (my MY $self, my Env $env) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | my $app = $self->{psgi_static} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 1 | ▶ | || $self->psgi_file_app($self->{doc_root}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{'psgi_static'} || $self->psgi_file_app($self->{'doc_root'})
MC/DC0%0/2
$self->{'psgi_static'} || $self->psgi_file_app($self->{'doc_root'})
$self->{'psgi_static'}
$self->psgi_file_app($self->{'doc_root'})
Truth table33%1/3
A || B
A= $self->{'psgi_static'}B= $self->psgi_file_app($self->{'doc_root'})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | # When PATH_INFO contains virtual path prefix (like /~$user/), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | # we need to strip them (for Plack::App::File). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 1 | local $env->{PATH_INFO} = $self->trim_site_prefix($env->{PATH_INFO}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 1 | $app->($env); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 3 | ▶ | sub psgi_handle_fallback { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
psgi_handle_fallback: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 3 | (my MY $self, my Env $env) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | (my $app = $self->{psgi_fallback} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | ||= $self->psgi_file_app($self->{doc_root})) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 3 | ▶ | or return [404, [], ["Cannot understand: ", $env->{PATH_INFO}]]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"psgi_fallback"} ||= $self->psgi_file_app($self->{"doc_root"})
MC/DC0%0/2
$self->{"psgi_fallback"} ||= $self->psgi_file_app($self->{"doc_root"})
$self->{"psgi_fallback"}
$self->psgi_file_app($self->{"doc_root"})
Truth table66%2/3
A ||= B
A= $self->{"psgi_fallback"}B= $self->psgi_file_app($self->{"doc_root"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 3 | local $env->{PATH_INFO} = $self->trim_site_prefix($env->{PATH_INFO}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 3 | $app->($env); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 4 | ▶ | sub trim_site_prefix { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
trim_site_prefix: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 4 | (my MY $self, my $path) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 4 | ▶ | if (my $pfx = $self->{site_prefix}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | substr($path, length($pfx)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 4 | $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | # XXX: Do we need to care about following headers too?: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | # * X-Content-Security-Policy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | # * X-Request-With | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | # * X-Frame-Options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | # * Strict-Transport-Security | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 500 | ▶ | sub set_yatt_script_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_yatt_script_name: called CC=8 SCAR=21.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 500 | (my MY $self, my Env $env) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 500 | my $script_name = $env->{'yatt.script_name'} = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 500 | ▶ | if (not $self->{no_trim_script_name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition63%7/11
not $self->{"no_trim_script_name"} and $env->{"REDIRECT_HANDLER"} and ($env->{"REDIRECT_STATUS"} // 0) == 200 and $env->{"SCRIPT_FILENAME"}
not $self->{"no_trim_script_name"} and $env->{"REDIRECT_HANDLER"} and ($env->{"REDIRECT_STATUS"} // 0) == 200
not $self->{"no_trim_script_name"} and $env->{"REDIRECT_HANDLER"}
$env->{"REDIRECT_STATUS"} // 0
MC/DC25%1/4
not $self->{"no_trim_script_name"} and $env->{"REDIRECT_HANDLER"} and ($env->{"REDIRECT_STATUS"} // 0) == 200 and $env->{"SCRIPT_FILENAME"}
not $self->{"no_trim_script_name"}
$env->{"REDIRECT_HANDLER"}
$env->{"REDIRECT_STATUS"}
$env->{"SCRIPT_FILENAME"}
Truth table40%2/5
not(A) and B and C and D
A= not $self->{"no_trim_script_name"}B= $env->{"REDIRECT_HANDLER"}C= $env->{"REDIRECT_STATUS"}D= $env->{"SCRIPT_FILENAME"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | and $env->{REDIRECT_HANDLER} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | and ($env->{REDIRECT_STATUS} // 0) == 200 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | and $env->{SCRIPT_FILENAME} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | # For Apache Action+AddHandler mapping. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | trim_common_suffix_from($env->{SCRIPT_NAME} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 27 | , $env->{SCRIPT_FILENAME}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | # Normal case. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 473 | ▶ | my $copy = $env->{SCRIPT_NAME} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$env->{"SCRIPT_NAME"} // ""
MC/DC100%1/1
$env->{"SCRIPT_NAME"} // ""
$env->{"SCRIPT_NAME"}
Truth table100%2/2
A
A= $env->{"SCRIPT_NAME"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 473 | $copy =~ s,/+\z,,; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 473 | $copy; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | # script_dir = script_name + / | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 500 | ▶ | ($env->{'yatt.script_dir'} = $script_name // '') =~ s,/*\z,/,; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$script_name // ""
MC/DC0%0/1
$script_name // ""
$script_name
Truth table50%1/2
A
A= $script_name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 500 | $script_name | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 497 | ▶ | sub split_path_info { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
split_path_info: called CC=16 SCAR=30.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 497 | (my MY $self, my Env $env) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 497 | ▶ | if (! $self->{per_role_docroot} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%4/6
not $self->{"per_role_docroot"} and nonempty($env->{"PATH_TRANSLATED"}) and $self->is_path_translated_mode($env)
not $self->{"per_role_docroot"} and nonempty($env->{"PATH_TRANSLATED"})
MC/DC33%1/3
not $self->{"per_role_docroot"} and nonempty($env->{"PATH_TRANSLATED"}) and $self->is_path_translated_mode($env)
not $self->{"per_role_docroot"}
nonempty($env->{"PATH_TRANSLATED"})
$self->is_path_translated_mode($env)
Truth table50%2/4
not(A) and B and C
A= not $self->{"per_role_docroot"}B= nonempty($env->{"PATH_TRANSLATED"})C= $self->is_path_translated_mode($env)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | && nonempty($env->{PATH_TRANSLATED}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | && $self->is_path_translated_mode($env)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | # [1] PATH_TRANSLATED mode. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | # If REDIRECT_STATUS == 200 and PATH_TRANSLATED is not empty, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | # use it as a template path. It must be located under app_root. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | # In this case, PATH_TRANSLATED should be valid physical path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | # + optionally trailing sub path_info. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | # XXX: What should be done when app_root is empty? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | # XXX: Is userdir ok? like /~$USER/dir? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | # XXX: should have cut_depth option. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | my ($tmpldir, $loc, $file, $trailer, $is_index, $request_file) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | = split_path($env->{PATH_TRANSLATED}, $self->{app_root} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | , $self->{use_subpath} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | , $self->{ext_public} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 35 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | # This is a workaround for $is_index. Determining $is_index only from | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | # PATH_TRANSLATED was just wrong. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | # So instead turn on it when "$env->{REQUEST_URI}$file" eq $env->{REDIRECT_URL}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 35 | ▶ | $is_index ||= do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$is_index ||= do {
if ($env->{"REQUEST_URI"} and $env->{"REDIRECT_URL"}) {
my $path = "URI"->new($env->{"REQUEST_URI"})->path;
"$path$file" eq $env->{"REDIRECT_URL"};
}
}
MC/DC50%1/2
$is_index ||= do {
if ($env->{"REQUEST_URI"} and $env->{"REDIRECT_URL"}) {
my $path = "URI"->new($env->{"REQUEST_URI"})->path;
"$path$file" eq $env->{"REDIRECT_URL"};
}
}
$is_index
do {
if ($env->{"REQUEST_URI"} and $env->{"REDIRECT_URL"}) {
my $path = "URI"->new($env->{"REQUEST_URI"})->path;
"$path$file" eq $env->{"REDIRECT_URL"};
}
}
Truth table66%2/3
A ||= B
A= $is_indexB= do {
if ($env->{"REQUEST_URI"} and $env->{"REDIRECT_URL"}) {
my $path = "URI"->new($env->{"REQUEST_URI"})->path;
"$path$file" eq $env->{"REDIRECT_URL"};
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 35 | ▶ | if ($env->{REQUEST_URI} and $env->{REDIRECT_URL}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$env->{"REQUEST_URI"} and $env->{"REDIRECT_URL"}
MC/DC50%1/2
$env->{"REQUEST_URI"} and $env->{"REDIRECT_URL"}
$env->{"REQUEST_URI"}
$env->{"REDIRECT_URL"}
Truth table66%2/3
A and B
A= $env->{"REQUEST_URI"}B= $env->{"REDIRECT_URL"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 24 | my $path = URI->new($env->{REQUEST_URI})->path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 24 | "$path$file" eq $env->{REDIRECT_URL}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | # GH-251: Likewise, PATH_TRANSLATED alone can not tell whether the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | # request spelled the file name with or without the extension | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | # (Apache MultiViews may have completed it). So correct | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | # $request_file by selecting the candidate which matches | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | # REQUEST_URI. Note: this only *selects* from known-safe | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | # candidates and never takes substrings of REQUEST_URI itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 35 | ▶ | if ($is_index) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 16 | $request_file = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | ▶ | } elsif (nonempty($env->{REQUEST_URI}) and nonempty($file)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
nonempty($env->{"REQUEST_URI"}) and nonempty($file)
MC/DC0%0/2
nonempty($env->{"REQUEST_URI"}) and nonempty($file)
nonempty($env->{"REQUEST_URI"})
nonempty($file)
Truth table33%1/3
A and B
A= nonempty($env->{"REQUEST_URI"})B= nonempty($file)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 19 | my $req_path = URI->new($env->{REQUEST_URI})->path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 19 | ▶ | $req_path =~ s{\Q$trailer\E\z}{} if nonempty($trailer); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 19 | foreach my $cand ($file, trim_ext($file, $self->{ext_public})) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 29 | ▶ | next unless $req_path =~ m{/\Q$cand\E\z}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 19 | $request_file = $cand; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 19 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | # When no candidate matches (e.g. rewritten request), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | # $request_file from PATH_TRANSLATED is kept as-is. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 35 | ($tmpldir, $loc, $file, $trailer, $is_index, $request_file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | } elsif (nonempty($env->{PATH_INFO})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | # [2] Template lookup mode. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 462 | my $tmpldirs = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 462 | ▶ | if ($self->{per_role_docroot}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | my $user = $env->{$self->{per_role_docroot_key}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | ▶ | $user ||= $self->{default_role}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$user ||= $self->{"default_role"}
MC/DC0%0/2
$user ||= $self->{"default_role"}
$user
$self->{"default_role"}
Truth table0%0/3
A ||= B
A= $userB= $self->{"default_role"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | ["$self->{per_role_docroot}/$user"] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | $self->{_tmpldirs} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 462 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | lookup_path($env->{PATH_INFO} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | , $tmpldirs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | , $self->{index_name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | , $self->{_handled_ext_list} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 462 | , $self->{use_subpath}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | # or die | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 979 | ▶ | sub has_forbidden_path { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_forbidden_path: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 979 | (my MY $self, my $path) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 979 | ▶ | if (not defined $path) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 461 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | elsif ($path =~ m{\.lib(?: / | $ )}x) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 1 | return ".lib: $path"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | elsif ($path =~ m{(?:^|/)\.ht|\.ytmpl$ }x) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | # XXX: basename() is just to ease testing. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 2 | return "filetype: " . basename($path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 515 | undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 35 | ▶ | sub is_path_translated_mode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_path_translated_mode: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 35 | (my MY $self, my Env $env) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 35 | ▶ | ($env->{REDIRECT_STATUS} // 0) == 200 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$env->{"REDIRECT_STATUS"} // 0
MC/DC0%0/1
$env->{"REDIRECT_STATUS"} // 0
$env->{"REDIRECT_STATUS"}
Truth table50%1/2
A
A= $env->{"REDIRECT_STATUS"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | # XXX: kludge! redundant! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 2 | ▶ | sub split_path_url { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
split_path_url: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 2 | (my MY $self, my ($path_translated, $path_info, $document_root)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 2 | my @info = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 2 | ▶ | if ($path_info =~ s{^(/~[^/]+)(?=/)}{}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 1 | my $user = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 1 | my ($root, $loc, $file, $trailer) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | = split_path($path_translated | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | , substr($path_translated, 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | , length($path_translated) - length($path_info)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | , 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 1 | (dir => "$root$loc", file => $file, subpath => $trailer | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | , root => $root, location => "$user$loc"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 1 | my ($root, $loc, $file, $trailer) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | = split_path($path_translated, $document_root, 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 1 | (dir => "$root$loc", file => $file, subpath => $trailer | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | , root => $root, location => $loc); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 2 | ▶ | if (wantarray) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | @info | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 0 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 2 | my %info = @info; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 2 | \%info; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | # どこを起点に split_path するか。UserDir の場合は '' を返す。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | ▶ | sub document_dir { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
document_dir: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | (my MY $self, my $cgi) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | my $path_info = $cgi->path_info; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 0 | ▶ | if (my ($user) = $path_info =~ m{^/~([^/]+)/}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 0 | ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 0 | ▶ | $self->{doc_root} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"doc_root"} // ""
MC/DC0%0/1
$self->{"doc_root"} // ""
$self->{"doc_root"}
Truth table0%0/2
A
A= $self->{"doc_root"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 6 | ▶ | sub is_debug_allowed { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_debug_allowed: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 6 | (my MY $self, my Env $env) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 6 | ▶ | return unless $self->{_allow_debug_from}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 5 | ▶ | return unless defined(my $ip = $self->guess_client_ip($env)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 5 | $self->is_debug_allowed_ip($ip); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 63 | ▶ | sub is_debug_allowed_ip { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_debug_allowed_ip: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 63 | (my MY $self, my $ip) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 63 | ▶ | $self->configure_allow_debug_from unless $self->{_allow_debug_from}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 63 | $self->{_allow_debug_from}->($ip); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | # The address of the client, for is_debug_allowed. Proxy headers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | # (X-Real-IP, X-Client-IP, X-Forwarded-For) are written by whoever | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | # sends the request, so they are believed only when the peer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | # (REMOTE_ADDR) is one of the configured trusted_proxies. Without that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | # config this is just REMOTE_ADDR. X-Forwarded-For is read from the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | # right: the rightmost hop not in trusted_proxies is the client; values | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | # to the left of it may have been planted by the client itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 44 | ▶ | sub guess_client_ip { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
guess_client_ip: called CC=9 SCAR=22.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 44 | (my MY $self, my Env $env) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 44 | my $remote = $env->{REMOTE_ADDR}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 44 | ▶ | return $remote unless defined $remote and $self->is_trusted_proxy($remote); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $remote and $self->is_trusted_proxy($remote)
MC/DC50%1/2
defined $remote and $self->is_trusted_proxy($remote)
defined $remote
$self->is_trusted_proxy($remote)
Truth table66%2/3
A and B
A= defined $remoteB= $self->is_trusted_proxy($remote)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 18 | foreach my $direct ($env->{HTTP_X_REAL_IP}, $env->{HTTP_X_CLIENT_IP}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 30 | ▶ | return $direct if defined $direct and $direct ne ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $direct and $direct ne ""
MC/DC50%1/2
defined $direct and $direct ne ""
defined $direct
$direct ne ""
Truth table66%2/3
A and B
A= defined $directB= $direct ne ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 11 | ▶ | if (defined(my $forward = $env->{HTTP_X_FORWARDED_FOR})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 9 | foreach my $hop (reverse grep {$_ ne ''} split /\s*,\s*/, ($forward =~ s/^\s+|\s+$//gr)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 12 | ▶ | return $hop unless $self->is_trusted_proxy($hop); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 4 | $remote; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 56 | ▶ | sub is_trusted_proxy { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_trusted_proxy: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 56 | (my MY $self, my $ip) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | my $matcher = $self->{_trusted_proxies} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 56 | ▶ | or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 35 | $matcher->($ip); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | 69 | *configure_debug_allowed_ip = *configure_allow_debug_from; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 69 | *configure_debug_allowed_ip = *configure_allow_debug_from; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 18 | ▶ | sub configure_allow_debug_from { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
configure_allow_debug_from: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 18 | (my MY $self, my $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | $self->{_allow_debug_from} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 18 | ▶ | = $self->compile_addr_matcher(allow_debug_from => $data // ['127.0.0.1', '::1']); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$data // ["127.0.0.1", "::1"]
MC/DC100%1/1
$data // ["127.0.0.1", "::1"]
$data
Truth table100%2/2
A
A= $data
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 6 | ▶ | sub configure_trusted_proxies { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
configure_trusted_proxies: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 6 | (my MY $self, my $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | $self->{_trusted_proxies} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 6 | ▶ | = defined $data ? $self->compile_addr_matcher(trusted_proxies => $data) : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | # Build a predicate sub for an address list. The default compares the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | # address as a whole string, exactly (no parsing, no extra module, to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | # keep CGI startup cheap). YATT::Lite::WebMVC0::Partial::StrictIPMatch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | # overrides this to parse addresses and accept CIDR ranges. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 12 | ▶ | sub compile_addr_matcher { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
compile_addr_matcher: called CC=3 SCAR=11.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 12 | (my MY $self, my ($name, $list)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 12 | ▶ | my @items = grep {defined $_ and $_ ne ''} lexpand($list); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
defined $_ && $_ ne ''
MC/DC0%0/2
defined $_ && $_ ne ''
defined $_
$_ ne ''
Truth table33%1/3
A && B
A= defined $_B= $_ ne ''
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 0 | ▶ | return sub { 0 } unless @items; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 12 | my $pat = join "|", map { quotemeta($_) } @items; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 12 | my $re = qr{^(?:$pat)\z}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 12 | ▶ | sub { defined $_[0] and $_[0] =~ $re }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 1514 | ▶ | sub has_htdebug { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_htdebug: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 1514 | (my MY $self, my $name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 1514 | my $envName = uc("htdebug_$name"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 1514 | ▶ | if (exists $ENV{$envName}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 2 | return $ENV{$envName}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | defined $self->{app_root} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | 1512 | ▶ | and -e "$self->{app_root}/.htdebug_$name" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 69 | ▶ | use YATT::Lite::WebMVC0::Connection; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | sub Connection () {'YATT::Lite::WebMVC0::Connection'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | sub ConnProp () {Connection} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 678 | ▶ | sub make_connection { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_connection: called CC=8 SCAR=27.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 678 | (my MY $self, my ($fh, @args)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 678 | my @opts = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 678 | ▶ | if ($self->{noheader}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | # direct mode. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 0 | ($fh, noheader => 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | # buffered mode. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 678 | (undef, parent_fh => $fh); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 678 | push @opts, site_prefix => $self->{site_prefix}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | 678 | ▶ | if (my $fn = $self->{logfile}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 0 | my $dir = $self->app_path_ensure_existing(dirname($fn)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | 0 | my $real = "$dir/" . basename($fn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 0 | ▶ | open my $fh, '>>', $real or die "Can't open logfile: fn=$real: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 0 | push @opts, logfh => $fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | push @opts, debug => $self->{debug_connection} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 678 | ▶ | if $self->{debug_connection}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 678 | ▶ | if (my $back = $self->{backend}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 0 | ▶ | push @opts, (backend => try_invoke($back, 'clone') // $back); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
try_invoke($back, "clone") // $back
MC/DC0%0/2
try_invoke($back, "clone") // $back
try_invoke($back, "clone")
$back
Truth table0%0/3
A // B
A= try_invoke($back, "clone")B= $back
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 678 | ▶ | if (my $enc = $$self{output_encoding}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | 678 | push @opts, encoding => $enc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | $self->SUPER::make_connection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | (@opts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 678 | , $self->cf_delegate_defined(qw(is_psgi | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | no_unicode_params | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | no_nested_query | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | mkquery_with_body_params)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | , @args); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 386 | ▶ | sub finalize_response { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finalize_response: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 386 | shift->next::method(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | # This will be called back from $CON->flush_heades. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 678 | ▶ | sub finalize_connection { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finalize_connection: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 678 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 678 | my ConnProp $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 678 | ▶ | $self->session_flush($glob) if $prop->{_session}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | # misc. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 0 | ▶ | sub header_charset { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
header_charset: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 0 | (my MY $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | 0 | ▶ | $self->{header_charset} || $self->{output_encoding}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | # Alternative dir_config under $app_root/config/$app_name.{yml,xhf} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | # Note: $app_name may contain '/'. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 0 | ▶ | sub dirapp_config_for { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dirapp_config_for: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 0 | (my MY $self, my $yatt_or_app_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 0 | ▶ | unless ($self->{config_dir}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 0 | Carp::croak "config_dir is empty!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 0 | my $app_name = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 0 | ▶ | if (not ref $yatt_or_app_name) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 0 | $yatt_or_app_name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | } elsif ($self->{use_sibling_config_dir}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 0 | $yatt_or_app_name->rel_app_name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 0 | $yatt_or_app_name->app_name | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 0 | my $base_path = "$self->{config_dir}/$app_name"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 0 | ▶ | my $has_latest_entry = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 0 | my ($dict, $key) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 0 | ▶ | defined (my $prev_entry = $dict->{$key}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 0 | my ($age, $path, $obj) = @$prev_entry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | ▶ | my $new_age = -M $path or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 0 | delete $dict->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 0 | ▶ | $new_age == $age | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 0 | $prev_entry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | 0 | ▶ | if (my $prev_entry = $has_latest_entry->($self->{_dirapp_config}, $base_path)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | $prev_entry->[-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | } elsif (my $cf = $self->find_unique_config_file($base_path)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | my $obj = $self->read_file($cf); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | $self->{_dirapp_config}{$base_path} = [-M $cf, $cf, $obj]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | $obj; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | 0 | undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 2 | ▶ | sub site_config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
site_config: called CC=2 SCAR=7.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 2 | (my MY $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 2 | ▶ | $self->{site_config} // do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"site_config"} // do {
$self->examine_site_config;
$self->{"site_config"}
}
MC/DC0%0/2
$self->{"site_config"} // do {
$self->examine_site_config;
$self->{"site_config"}
}
$self->{"site_config"}
do {
$self->examine_site_config;
$self->{"site_config"}
}
Truth table33%1/3
A // B
A= $self->{"site_config"}B= do {
$self->examine_site_config;
$self->{"site_config"}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 2 | $self->examine_site_config; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | 2 | $self->{site_config}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 620 | ▶ | sub examine_site_config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
examine_site_config: called CC=8 SCAR=20.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 620 | (my MY $self, my $con) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | 620 | ▶ | if ($con) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | # Cache should be examined at most once for each request. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | 618 | my ConnProp $prop = $con->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 618 | ▶ | return if $prop->{_site_config_is_examined}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 612 | ▶ | if (my $cache_entry = $self->{_site_config_cache_entry}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 8 | my ($age, $fn) = @$cache_entry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 8 | my $cur_age = -M $fn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 8 | ▶ | if (not defined $cur_age) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | # Cached file is deleted, so cache should be deleted too. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 0 | delete $self->{_site_config_cache_entry}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | } elsif ($age == $cur_age) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | # Cache is valid. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 4 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | # Examine app.site_config.{yml,xhf} and site_config.{yml,xhf}. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | my ($cf) = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | ($self->{use_sibling_config_dir} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | ? $self->find_unique_config_file($self->{config_dir}, "/site_config") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | : ()), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | # Note: $self->{app_rootname} and $self->{app_root} can be undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | # but find_unique_config_file() can safely ignore undef. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | $self->find_unique_config_file($self->{app_rootname}, ".site_config"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 608 | ▶ | $self->find_unique_config_file($self->{app_root}, "/site_config"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | 608 | ▶ | if ($cf) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 10 | $self->{site_config} = $self->read_file($cf); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 10 | $self->{_site_config_cache_entry} = [-M $cf, $cf]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 10 | $self->site_config_load_hook; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 598 | $self->{site_config} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | 10 | ▶ | sub site_config_load_hook { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
site_config_load_hook: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 10 | (my MY $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | 10 | ▶ | if ($self->{site_config_as_entity}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 10 | my $entns = $self->EntNS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | 10 | foreach my $name (keys %{$self->{site_config}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 26 | ▶ | next if $name =~ /\W/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | 16 | ▶ | $self->add_entity_into($entns, $name, sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | 16 | my MY $actual = $SYS; # To avoid directly capturing $self. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 16 | $actual->{site_config}{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 18 | }, 1); # Just ignore if already defined. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | 8 | ▶ | Entity site_config => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 8 | my ($this, $name, $default) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 8 | my MY $self = $SYS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | 8 | $SYS->examine_site_config($CON); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | 8 | ▶ | return $self->{site_config} unless defined $name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | 4 | ▶ | $self->{site_config}{$name} // $default; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"site_config"}{$name} // $default
MC/DC0%0/2
$self->{"site_config"}{$name} // $default
$self->{"site_config"}{$name}
$default
Truth table33%1/3
A // B
A= $self->{"site_config"}{$name}B= $default
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | 69 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | 21 | ▶ | Entity is_debug_allowed_ip => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | 21 | my ($this, $remote_addr) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | 21 | my MY $self = $SYS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 21 | ▶ | $remote_addr //= do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$remote_addr //= do {
my YATT::Lite::WebMVC0::SiteApp::Env $env = $YATT::Lite::WebMVC0::SiteApp::CON->env;
$self->guess_client_ip($env)
}
MC/DC0%0/2
$remote_addr //= do {
my YATT::Lite::WebMVC0::SiteApp::Env $env = $YATT::Lite::WebMVC0::SiteApp::CON->env;
$self->guess_client_ip($env)
}
$remote_addr
do {
my YATT::Lite::WebMVC0::SiteApp::Env $env = $YATT::Lite::WebMVC0::SiteApp::CON->env;
$self->guess_client_ip($env)
}
Truth table66%2/3
A //= B
A= $remote_addrB= do {
my YATT::Lite::WebMVC0::SiteApp::Env $env = $YATT::Lite::WebMVC0::SiteApp::CON->env;
$self->guess_client_ip($env)
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | 18 | my Env $env = $CON->env; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | 18 | $self->guess_client_ip($env); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | 21 | ▶ | $remote_addr && $self->is_debug_allowed_ip($remote_addr) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 69 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | 69 | foreach my $name (qw/ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | file_location | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | page_location | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | dir_location | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | is_current_file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | is_current_page | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | file_page | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | site_path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | site_url | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | current_path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | current_url | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | raise_redirect | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | / | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 759 | my $method = $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | 662 | ▶ | Entity $method => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | 662 | shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 662 | $CON->$method(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | 759 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | 69 | foreach my $item (map([$_ => uc($_)] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | , qw/path_info | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | request_uri | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | script_filename | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | SCRIPT_NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | SCRIPT_URI | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | SCRIPT_URL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | /)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 414 | my ($method, $env_name) = @$item; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | 0 | ▶ | Entity $method => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | 0 | my Env $env = $CON->env; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | 0 | $env->{$env_name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | 414 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | # &yatt:SCRIPT_NAME(); is original $env->{SCRIPT_NAME} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | # &yatt:script_name(); is $env->{'yatt.script_name'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | 15 | ▶ | Entity script_name => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | 15 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | 15 | my Env $env = $CON->env; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | 15 | $env->{'yatt.script_name'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | 69 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | 0 | ▶ | Entity script_dir => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | 0 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | 0 | my Env $env = $CON->env; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | 0 | $env->{'yatt.script_dir'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | 69 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | # GH-205 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | # &yatt:SCRIPT_URI(); is original $env->{SCRIPT_URI} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | # &yatt:script_uri(); cares HTTP_X_FORWARDED_PROTO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | 4 | ▶ | Entity script_uri => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | 4 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | 4 | $CON->mkprefix . $this->entity_script_url; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | 69 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | 4 | ▶ | Entity script_url => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | 4 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | 4 | my Env $env = $CON->env; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | 4 | ▶ | $env->{SCRIPT_URL} // $this->entity_file_location; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$env->{"SCRIPT_URL"} // $this->entity_file_location
MC/DC0%0/2
$env->{"SCRIPT_URL"} // $this->entity_file_location
$env->{"SCRIPT_URL"}
$this->entity_file_location
Truth table33%1/3
A // B
A= $env->{"SCRIPT_URL"}B= $this->entity_file_location
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | 69 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | # :abspath() - location + file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | 4 | ▶ | Entity abspath => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | 4 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | 4 | my ConnProp $prop = $CON->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | 4 | ▶ | ($prop->{location} // '').($prop->{file} // ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$prop->{"location"} // ""
$prop->{"file"} // ""
MC/DC0%0/1
$prop->{"location"} // ""
$prop->{"location"}
MC/DC0%0/1
$prop->{"file"} // ""
$prop->{"file"}
Truth table50%1/2
A
A= $prop->{"location"}
Truth table50%1/2
A
A= $prop->{"file"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | 69 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | 0 | ▶ | Entity abspath_in_siteapp => sub {shift->entity_abspath}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | # :absrequest() - REQUEST_URI - yatt.script_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | # Note: since this value is derived from REQUEST_URI, which do not contain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | # index.yatt typically, this is not suitable to get physical filename. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | 4 | ▶ | Entity absrequest => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | 4 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | 4 | my Env $env = $CON->env; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | 4 | my $url = substr($env->{REQUEST_URI}, length $env->{'yatt.script_name'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | 4 | $url =~ s{\?.*}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | 4 | $url; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | 69 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | 69 | YATT::Lite::Breakpoint::break_load_dispatcher(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | 69 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||