| 1 | package YATT::Lite::WebMVC0::SiteApp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 43 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 43 | ▶ | use warnings qw(FATAL all NONFATAL misc); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 43 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 43 | ▶ | use YATT::Lite::Breakpoint; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | sub MY () {__PACKAGE__} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 43 | ▶ | use mro 'c3'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 43 | ▶ | 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 | 43 | ▶ | 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 | 43 | ▶ | use parent qw(YATT::Lite::Factory); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 43 | ▶ | 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 | debug_cgi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | debug_psgi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | debug_connection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | debug_backend | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | psgi_static | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | psgi_fallback | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | per_role_docroot | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | per_role_docroot_key | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | default_role | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | backend | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | site_config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | _site_config_cache_entry | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | site_config_as_entity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | logfile | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | overwrite_status_code_for_errors_as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | _re_handled_ext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | _handled_ext_list | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | ^progname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | no_trim_script_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | ext_public_action | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | ^config_dir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | _dirapp_config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | use_sibling_config_dir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 43 | /; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 43 | ▶ | use YATT::Lite::Util qw(cached_in split_path catch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | lookup_path nonempty try_invoke | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | trim_ext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | mk_http_status | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | default ckrequire | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | escape | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | trim_common_suffix_from | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | is_done | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | lexpand rootname extname untaint_any terse_dump | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | add_entity_into | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 43 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 43 | ▶ | use YATT::Lite::Util::CmdLine qw(parse_params); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 43 | ▶ | use YATT::Lite qw/Entity *SYS *CON/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 43 | our @EXPORT_OK = qw/*CON/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 43 | ▶ | use YATT::Lite::WebMVC0::DirApp (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | sub DirApp () {'YATT::Lite::WebMVC0::DirApp'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | sub default_default_app () {'YATT::Lite::WebMVC0::DirApp'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 109 | ▶ | sub default_ext_public_action {'ydo'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_ext_public_action: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 43 | ▶ | use File::Basename; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 109 | ▶ | sub after_new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
after_new: called CC=8 SCAR=23.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 109 | (my MY $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 109 | $self->SUPER::after_new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 109 | ▶ | $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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | $self->{_handled_ext_list} = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | $self->{ext_public}, $self->{ext_public_action} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 109 | ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 109 | $self->{_re_handled_ext} = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 109 | my $str = join("|", @{$self->{_handled_ext_list}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 109 | qr{\.($str)$}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 109 | ▶ | $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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 109 | ▶ | $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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 109 | ▶ | $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];
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 109 | ▶ | if (not $self->{app_root}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } elsif ($self->{use_sibling_config_dir}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 3 | "$self->{app_root}.config.d" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 106 | "$self->{app_root}/config" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 109 | $self->{_dirapp_config} = +{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 109 | ▶ | $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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 109 | ▶ | sub default_per_role_docroot_key { 'yatt.role' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_per_role_docroot_key: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 109 | ▶ | sub default_default_role { 'nobody' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_default_role: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 109 | ▶ | sub default_site_config_as_entity {1} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_site_config_as_entity: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 137 | ▶ | sub _cf_delegates { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cf_delegates: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | (shift->SUPER::_cf_delegates | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 137 | , qw(overwrite_status_code_for_errors_as)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | # runas($type, $fh, \%ENV, \@ARGV) ... for CGI/FCGI support. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 16 | ▶ | sub runas { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
runas: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 16 | (my $this, my $type) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 16 | ▶ | my MY $self = ref $this ? $this : $this->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 16 | ▶ | my $sub = $self->can("runas_$type") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | or die "\n\nUnknown runas type: $type"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 16 | $sub->($self, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 16 | ▶ | sub runas_cgi { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
runas_cgi: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 16 | require YATT::Lite::WebMVC0::SiteApp::CGI; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 16 | shift->_runas_cgi(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | sub runas_fcgi { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
runas_fcgi: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | require YATT::Lite::WebMVC0::SiteApp::FCGI; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | shift->_runas_fcgi(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | # callas($type, $app, $fh, \%ENV, \@ARGV, %opts) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | sub callas { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
callas: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | (my $this, my $type) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | my MY $self = ref $this ? $this : $this->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | my $sub = $self->can("callas_$type") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | or die "\n\nUnknown callas type: $type"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | $sub->($self, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | sub callas_cgi { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
callas_cgi: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | require YATT::Lite::WebMVC0::SiteApp::CGI; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | shift->_callas_cgi(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | sub callas_fcgi { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
callas_fcgi: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | require YATT::Lite::WebMVC0::SiteApp::FCGI; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | shift->_callas_fcgi(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | # Dispatcher::get_dirhandler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | # -> Util::cached_in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | # -> Factory::load | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | # -> Factory::buildspec | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 418 | ▶ | sub get_lochandler { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_lochandler: called CC=3 SCAR=15.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 418 | (my MY $self, my ($location, $tmpldir)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 418 | ▶ | if ($self->{per_role_docroot}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | # When per_role_docroot is on, $tmpldir already points | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | # $per_role_docroot/$role. So just append $location. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | # Unfortunately, $self->error_response calls get_lochandler without $tmpldir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | $self->get_dirhandler($tmpldir.$location); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 418 | $self->SUPER::get_lochandler($location, $tmpldir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | #---------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | # preload_handlers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 1 | ▶ | sub preload_apps { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
preload_apps: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 1 | (my MY $self, my (@dir)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 1 | ▶ | push @dir, $self->{doc_root} unless @dir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | my @apps; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 1 | foreach my $dir ($self->find_apps(@dir)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 4 | push @apps, my $app = $self->get_dirhandler($dir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 1 | @apps; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 1 | ▶ | sub find_apps { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_apps: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 1 | (my MY $self, my @dir) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 1 | require File::Find; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 1 | my @apps; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 17 | ▶ | my $handler = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 17 | ▶ | push @apps, $_ if -d; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 1 | File::Find::find({wanted => $handler | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | , no_chdir => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | , follow_skip => 2} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | , @dir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 1 | @apps; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | # PSGI Adaptor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 43 | ▶ | use YATT::Lite::PSGIEnv qw/SCRIPT_URL/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 37 | ▶ | sub to_app { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to_app: called CC=3 SCAR=13.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 37 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | # XXX: Should check it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | # unless (defined $self->{app_root}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | # croak "app_root is undef!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 37 | ▶ | 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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | or defined $self->{per_role_docroot}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | croak "document_root is undef!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 37 | return $self->SUPER::to_app(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 39 | ▶ | sub prepare_app { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare_app: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 39 | (my MY $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 39 | $self->next::method; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 39 | $self->{is_psgi} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 39 | require Plack::Request; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 39 | require Plack::Response; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 39 | require Plack::Util; # for response_cb in call(). Do not rely on plackup. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 39 | my $backend; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 39 | ▶ | 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")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | and my $sub = $backend->can('startup')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 1 | $sub->($backend, $self, $self->preload_apps); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 314 | ▶ | sub call { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
call: called CC=38 SCAR=47.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 314 | (my MY $self, my Env $env) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 314 | YATT::Lite::Breakpoint::break_psgi_call(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 314 | ▶ | if ($self->has_htdebug("env")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 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->{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | sort keys %$env); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 314 | ▶ | 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"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | // $self->has_forbidden_path($env->{PATH_TRANSLATED})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 3 | return $self->psgi_error(403, "Forbidden $deny"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 311 | ▶ | 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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | and $self->{output_encoding}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | $env->{PATH_INFO} = Encode::decode($self->{output_encoding} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 311 | , $env->{PATH_INFO}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 311 | ▶ | 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"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | and my ($path_prefix, $psgi_app) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | = $self->lookup_psgi_mount($env->{PATH_INFO})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 7 | require Plack::Util; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 7 | local $env->{PATH_INFO} = $self->trimleft_length($env->{PATH_INFO}, $path_prefix); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 7 | local $env->{SCRIPT_NAME} = $self->trimleft_length($env->{SCRIPT_NAME}, $path_prefix); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 7 | return Plack::Util::run_app($psgi_app, $env); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | # XXX: user_dir? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 304 | my ($tmpldir, $loc, $file, $trailer, $is_index, $request_file) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | = my @pi = $self->split_path_info($env); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 304 | ▶ | 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[/\.\./]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | return $self->psgi_error(403, "Bad location: $loc"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | # Set $env->{yatt.script_name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 304 | $self->set_yatt_script_name($env); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 304 | my ($realdir, $virtdir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 304 | ▶ | if (@pi) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 301 | $realdir = "$tmpldir$loc"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | $virtdir = defined $self->{doc_root} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 301 | ▶ | ? "$self->{doc_root}$loc" : $realdir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 304 | ▶ | if ($self->has_htdebug("path_info")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | return $self->psgi_dump([tmpldir => $tmpldir] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | , [loc => $loc] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | , [file => $file] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | , [trailer => $trailer] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | , [virtdir => $virtdir, realdir => $realdir] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 304 | ▶ | if ($self->{debug_psgi}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | # XXX: should be configurable. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | if (my $errfh = fileno(STDERR) ? \*STDERR : $env->{'psgi.errors'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | print $errfh join("\t" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | , "# REQ: " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | , terse_dump([tmpldir => $tmpldir] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | , [loc => $loc] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | , [file => $file] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | , [trailer => $trailer] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | , ['all templdirs', $self->{_tmpldirs}] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | , map {[$_ => $env->{$_}]} sort keys %$env) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | ), "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 304 | ▶ | unless (@pi) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 3 | return $self->psgi_handle_fallback($env); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 301 | ▶ | unless (-d $realdir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | return $self->psgi_error(404, "Not found: $loc"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | # Default index file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | # Note: Files may placed under (one of) tmpldirs instead of docroot. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 301 | ▶ | if ($file eq '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | $file = "$self->{index_name}.$self->{ext_public}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | } elsif ($file eq $self->{index_name}) { #XXX: $is_index | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | $file .= ".$self->{ext_public}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 301 | ▶ | if ($file !~ $self->{_re_handled_ext}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 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")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | return $self->psgi_dump("Not handled since extension doesn't match" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | , $file, $self->{_re_handled_ext}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 1 | return $self->psgi_handle_static($env); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 300 | ▶ | my $dh = $self->get_lochandler(map {untaint_any($_)} $loc, $tmpldir) or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | return $self->psgi_error(404, "No such directory: $loc"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | # To support $con->param and other cgi compat methods. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 300 | my $req = Plack::Request->new($env); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 300 | ▶ | $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"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | my @params = (env => $env | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | , path_info => $env->{PATH_INFO} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 300 | ▶ | , $self->connection_quad([$virtdir, $loc, $file, $trailer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | , $request_file]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | , $is_index ? (is_index => 1) : () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | , is_psgi => 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 300 | local $CON = my $con = $self->make_connection(undef, @params, yatt => $dh, noheader => 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 300 | ▶ | my $error = catch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 300 | $CON->configure(cgi => $req); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 300 | $self->run_dirhandler($dh, $con, $file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 300 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 300 | try_invoke($con, 'flush_headers'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 300 | ▶ | if ($self->has_htdebug("response")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | return [200, [], [terse_dump(["caught exception" => $error]) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | , "\n", terse_dump(["diag(inner to outer)" => $CON->diag_list]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | , "\n", terse_dump(["buffers(inner to outer)" => $CON->oldbuf, $CON->buffer]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 300 | ▶ | if ($con->is_error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 22 | print STDERR "# EARLY ERROR\n" if DEBUG_ERROR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 22 | my $error_list = $con->error_list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 22 | return $self->error_response($error_list->[0], $env, $con); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | ▶ | 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)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 266 | print STDERR "# NORMAL\n" if DEBUG_ERROR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 266 | return $self->psgi_response_of_connection($con, $env); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | ▶ | } 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"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 12 | print STDERR "# SPECIAL\n" if DEBUG_ERROR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | # redirect | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 12 | ▶ | if ($self->{debug_psgi}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | ▶ | if (my $errfh = fileno(STDERR) ? \*STDERR : $env->{'psgi.errors'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | print $errfh "PSGI Response: ", terse_dump($error), "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 12 | ▶ | return Plack::Util::response_cb($error, sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 12 | my $res = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 12 | $self->finalize_response($env, $res); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 12 | $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 12 | }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | } elsif (UNIVERSAL::isa($error, 'YATT::Lite::Error')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | print STDERR "# ERROR\n" if DEBUG_ERROR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | return $self->error_response($error, $env, $con); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | print STDERR "# from raw die\n" if DEBUG_ERROR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | # system_error. Should be treated by PSGI Server. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | die $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 23 | ▶ | sub error_response { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
error_response: called CC=6 SCAR=18.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 23 | (my MY $self, my $err, my Env $env, my $orig_con) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | my $error_status = $self->{overwrite_status_code_for_errors_as} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | // $err->{http_status_code} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 23 | ▶ | // $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")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | // 500; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 23 | my $root = $self->get_lochandler('/'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 23 | ▶ | if (my ($sub, $pkg) = $root->find_renderer(error => ignore_error => 1)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 2 | my $errcon = $orig_con->as_error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 2 | local ($SYS, $CON) = ($self, $errcon); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 2 | $sub->($pkg, $errcon, $err); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 2 | $self->psgi_response_of_connection($errcon, $env); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 21 | ▶ | 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")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | , $err->byte_message); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 268 | ▶ | sub psgi_response_of_connection { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
psgi_response_of_connection: called CC=6 SCAR=18.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 268 | (my MY $self, my $con, my Env $env) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 268 | ▶ | $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")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 268 | ▶ | 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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 268 | my $res = Plack::Response->new($code); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | $res->content_type("text/html" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | . ($self->{header_charset} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 268 | ▶ | ? qq{; charset="$self->{header_charset}"} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | : "")); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 268 | ▶ | if (my @h = $con->list_header) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | $res->headers->header(@h); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 268 | $res->body($con->buffer); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 268 | my $tuple = $res->finalize; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 268 | $self->finalize_response($env, $tuple); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 268 | return $tuple; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 383 | ▶ | sub before_dirhandler { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
before_dirhandler: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 383 | (my MY $self, my ($dh, $con, $file)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 383 | ▶ | if ($self->{site_config_as_entity}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 383 | $self->examine_site_config($con); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 383 | &maybe::next::method; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 68 | ▶ | sub make_debug_params { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_debug_params: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 68 | (my MY $self, my ($reqrec, $args)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 68 | ▶ | my ($path_info, @rest) = ref $reqrec ? @$reqrec : $reqrec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 68 | my Env $env = Env->psgi_simple_env; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 68 | $env->{PATH_INFO} = $path_info; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 68 | $env->{REQUEST_URI} = $path_info; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 68 | my @params = ($self->SUPER::make_debug_params($reqrec, $args) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | , env => $env); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 68 | require Plack::Request; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 68 | push @params, cgi => Plack::Request->new($env) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | , parameters => YATT::Lite::Util::ixhash(lexpand($args)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | , is_psgi => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 68 | @params; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 1 | ▶ | sub psgi_handle_static { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
psgi_handle_static: called CC=2 SCAR=7.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 1 | (my MY $self, my Env $env) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | my $app = $self->{psgi_static} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 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'})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | # When PATH_INFO contains virtual path prefix (like /~$user/), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | # we need to strip them (for Plack::App::File). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 1 | local $env->{PATH_INFO} = $self->trim_site_prefix($env->{PATH_INFO}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 1 | $app->($env); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 3 | ▶ | sub psgi_handle_fallback { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
psgi_handle_fallback: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 3 | (my MY $self, my Env $env) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | (my $app = $self->{psgi_fallback} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | ||= $self->psgi_file_app($self->{doc_root})) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 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"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 3 | local $env->{PATH_INFO} = $self->trim_site_prefix($env->{PATH_INFO}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 3 | $app->($env); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 4 | ▶ | sub trim_site_prefix { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
trim_site_prefix: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 4 | (my MY $self, my $path) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 4 | ▶ | if (my $pfx = $self->{site_prefix}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | substr($path, length($pfx)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 4 | $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | # XXX: Do we need to care about following headers too?: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | # * X-Content-Security-Policy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | # * X-Request-With | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | # * X-Frame-Options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | # * Strict-Transport-Security | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 319 | ▶ | sub set_yatt_script_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_yatt_script_name: called CC=8 SCAR=21.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 319 | (my MY $self, my Env $env) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 319 | my $script_name = $env->{'yatt.script_name'} = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 319 | ▶ | 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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | and $env->{REDIRECT_HANDLER} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | and ($env->{REDIRECT_STATUS} // 0) == 200 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | and $env->{SCRIPT_FILENAME} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | # For Apache Action+AddHandler mapping. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | trim_common_suffix_from($env->{SCRIPT_NAME} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 27 | , $env->{SCRIPT_FILENAME}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | # Normal case. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 292 | ▶ | 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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 292 | $copy =~ s,/+\z,,; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 292 | $copy; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | # script_dir = script_name + / | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 319 | ▶ | ($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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 319 | $script_name | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 320 | ▶ | sub split_path_info { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
split_path_info: called CC=16 SCAR=30.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 320 | (my MY $self, my Env $env) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 320 | ▶ | 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)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | && nonempty($env->{PATH_TRANSLATED}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | && $self->is_path_translated_mode($env)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | # [1] PATH_TRANSLATED mode. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | # If REDIRECT_STATUS == 200 and PATH_TRANSLATED is not empty, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | # use it as a template path. It must be located under app_root. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | # In this case, PATH_TRANSLATED should be valid physical path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | # + optionally trailing sub path_info. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | # XXX: What should be done when app_root is empty? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | # XXX: Is userdir ok? like /~$USER/dir? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | # XXX: should have cut_depth option. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | my ($tmpldir, $loc, $file, $trailer, $is_index, $request_file) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | = split_path($env->{PATH_TRANSLATED}, $self->{app_root} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | , $self->{use_subpath} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | , $self->{ext_public} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 35 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | # This is a workaround for $is_index. Determining $is_index only from | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | # PATH_TRANSLATED was just wrong. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | # So instead turn on it when "$env->{REQUEST_URI}$file" eq $env->{REDIRECT_URL}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 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"};
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 24 | my $path = URI->new($env->{REQUEST_URI})->path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 24 | "$path$file" eq $env->{REDIRECT_URL}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | # GH-251: Likewise, PATH_TRANSLATED alone can not tell whether the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | # request spelled the file name with or without the extension | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | # (Apache MultiViews may have completed it). So correct | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | # $request_file by selecting the candidate which matches | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | # REQUEST_URI. Note: this only *selects* from known-safe | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | # candidates and never takes substrings of REQUEST_URI itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 35 | ▶ | if ($is_index) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 16 | $request_file = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | ▶ | } 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)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 19 | my $req_path = URI->new($env->{REQUEST_URI})->path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 19 | ▶ | $req_path =~ s{\Q$trailer\E\z}{} if nonempty($trailer); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 19 | foreach my $cand ($file, trim_ext($file, $self->{ext_public})) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 29 | ▶ | next unless $req_path =~ m{/\Q$cand\E\z}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 19 | $request_file = $cand; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 19 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | # When no candidate matches (e.g. rewritten request), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | # $request_file from PATH_TRANSLATED is kept as-is. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 35 | ($tmpldir, $loc, $file, $trailer, $is_index, $request_file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | } elsif (nonempty($env->{PATH_INFO})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | # [2] Template lookup mode. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 285 | my $tmpldirs = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 285 | ▶ | if ($self->{per_role_docroot}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | my $user = $env->{$self->{per_role_docroot_key}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | ["$self->{per_role_docroot}/$user"] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | $self->{_tmpldirs} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 285 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | lookup_path($env->{PATH_INFO} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | , $tmpldirs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | , $self->{index_name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | , $self->{_handled_ext_list} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 285 | , $self->{use_subpath}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | # or die | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 625 | ▶ | sub has_forbidden_path { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_forbidden_path: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 625 | (my MY $self, my $path) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 625 | ▶ | if (not defined $path) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 284 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | elsif ($path =~ m{\.lib(?: / | $ )}x) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 1 | return ".lib: $path"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | elsif ($path =~ m{(?:^|/)\.ht|\.ytmpl$ }x) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | # XXX: basename() is just to ease testing. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 2 | return "filetype: " . basename($path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 338 | undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 35 | ▶ | sub is_path_translated_mode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_path_translated_mode: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 35 | (my MY $self, my Env $env) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | # XXX: kludge! redundant! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 2 | ▶ | sub split_path_url { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
split_path_url: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 2 | (my MY $self, my ($path_translated, $path_info, $document_root)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 2 | my @info = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 2 | ▶ | if ($path_info =~ s{^(/~[^/]+)(?=/)}{}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 1 | my $user = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 1 | my ($root, $loc, $file, $trailer) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | = split_path($path_translated | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | , substr($path_translated, 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | , length($path_translated) - length($path_info)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | , 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 1 | (dir => "$root$loc", file => $file, subpath => $trailer | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | , root => $root, location => "$user$loc"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 1 | my ($root, $loc, $file, $trailer) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | = split_path($path_translated, $document_root, 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 1 | (dir => "$root$loc", file => $file, subpath => $trailer | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | , root => $root, location => $loc); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 2 | ▶ | if (wantarray) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | @info | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 2 | my %info = @info; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 2 | \%info; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | # どこを起点に split_path するか。UserDir の場合は '' を返す。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 0 | ▶ | sub document_dir { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
document_dir: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 0 | (my MY $self, my $cgi) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | my $path_info = $cgi->path_info; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | ▶ | if (my ($user) = $path_info =~ m{^/~([^/]+)/}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 0 | ▶ | sub is_debug_allowed { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_debug_allowed: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | (my MY $self, my Env $env) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 0 | ▶ | return unless $self->{_allow_debug_from}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | ▶ | return unless defined(my $ip = $self->guess_client_ip($env)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | $self->is_debug_allowed_ip($ip); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 2 | ▶ | sub is_debug_allowed_ip { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_debug_allowed_ip: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 2 | (my MY $self, my $ip) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 2 | ▶ | $self->configure_allow_debug_from unless $self->{_allow_debug_from}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 2 | $ip =~ $self->{_allow_debug_from}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 2 | ▶ | sub guess_client_ip { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
guess_client_ip: called CC=4 SCAR=17.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 2 | (my MY $self, my Env $env) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 2 | ▶ | $env->{HTTP_X_REAL_IP} // $env->{HTTP_X_CLIENT_IP} // do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
($env->{"HTTP_X_REAL_IP"} // $env->{"HTTP_X_CLIENT_IP"}) // do {
if (defined(my $forward = $env->{"HTTP_X_FORWARDED_FOR"})) {
[split(/(?:\s*,\s*|\s+)/, $forward, 0)]->[0];
}
else {
$env->{"REMOTE_ADDR"};
}
}
$env->{"HTTP_X_REAL_IP"} // $env->{"HTTP_X_CLIENT_IP"}
MC/DC0%0/3
($env->{"HTTP_X_REAL_IP"} // $env->{"HTTP_X_CLIENT_IP"}) // do {
if (defined(my $forward = $env->{"HTTP_X_FORWARDED_FOR"})) {
[split(/(?:\s*,\s*|\s+)/, $forward, 0)]->[0];
}
else {
$env->{"REMOTE_ADDR"};
}
}
$env->{"HTTP_X_REAL_IP"}
$env->{"HTTP_X_CLIENT_IP"}
do {
if (defined(my $forward = $env->{"HTTP_X_FORWARDED_FOR"})) {
[split(/(?:\s*,\s*|\s+)/, $forward, 0)]->[0];
}
else {
$env->{"REMOTE_ADDR"};
}
}
Truth table25%1/4
A // B // C
A= $env->{"HTTP_X_REAL_IP"}B= $env->{"HTTP_X_CLIENT_IP"}C= do {
if (defined(my $forward = $env->{"HTTP_X_FORWARDED_FOR"})) {
[split(/(?:\s*,\s*|\s+)/, $forward, 0)]->[0];
}
else {
$env->{"REMOTE_ADDR"};
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 2 | ▶ | if (defined(my $forward = $env->{HTTP_X_FORWARDED_FOR})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 0 | [split /(?:\s*,\s*|\s+)/, $forward]->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | $env->{REMOTE_ADDR} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 2 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 43 | *configure_debug_allowed_ip = *configure_allow_debug_from; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 43 | *configure_debug_allowed_ip = *configure_allow_debug_from; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 1 | ▶ | sub configure_allow_debug_from { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
configure_allow_debug_from: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 1 | (my MY $self, my $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 1 | ▶ | my $pat = join "|", map { quotemeta($_) } lexpand($data // ['127.0.0.1']); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$data // ["127.0.0.1"]
MC/DC0%0/1
$data // ["127.0.0.1"]
$data
Truth table50%1/2
A
A= $data
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 1 | $self->{_allow_debug_from} = qr{^(?:$pat)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 966 | ▶ | sub has_htdebug { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_htdebug: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 966 | (my MY $self, my $name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 966 | my $envName = uc("htdebug_$name"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 966 | ▶ | if (exists $ENV{$envName}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 0 | return $ENV{$envName}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | defined $self->{app_root} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 966 | ▶ | and -e "$self->{app_root}/.htdebug_$name" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 43 | ▶ | use YATT::Lite::WebMVC0::Connection; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | sub Connection () {'YATT::Lite::WebMVC0::Connection'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | sub ConnProp () {Connection} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 434 | ▶ | sub make_connection { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_connection: called CC=8 SCAR=27.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 434 | (my MY $self, my ($fh, @args)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 434 | my @opts = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 434 | ▶ | if ($self->{noheader}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | # direct mode. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 0 | ($fh, noheader => 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | # buffered mode. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 434 | (undef, parent_fh => $fh); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 434 | push @opts, site_prefix => $self->{site_prefix}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 434 | ▶ | if (my $fn = $self->{logfile}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 0 | my $dir = $self->app_path_ensure_existing(dirname($fn)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 0 | my $real = "$dir/" . basename($fn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 0 | ▶ | open my $fh, '>>', $real or die "Can't open logfile: fn=$real: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 0 | push @opts, logfh => $fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | push @opts, debug => $self->{debug_connection} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 434 | ▶ | if $self->{debug_connection}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 434 | ▶ | if (my $back = $self->{backend}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 434 | ▶ | if (my $enc = $$self{output_encoding}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 434 | push @opts, encoding => $enc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | $self->SUPER::make_connection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | (@opts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 434 | , $self->cf_delegate_defined(qw(is_psgi | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | no_unicode_params | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | no_nested_query | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | mkquery_with_body_params)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | , @args); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 280 | ▶ | sub finalize_response { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finalize_response: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 280 | shift->next::method(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | # This will be called back from $CON->flush_heades. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 434 | ▶ | sub finalize_connection { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finalize_connection: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 434 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | 434 | my ConnProp $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 434 | ▶ | $self->session_flush($glob) if $prop->{_session}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | # misc. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | ▶ | sub header_charset { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
header_charset: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | (my MY $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | 0 | ▶ | $self->{header_charset} || $self->{output_encoding}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | # Alternative dir_config under $app_root/config/$app_name.{yml,xhf} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | # Note: $app_name may contain '/'. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 0 | ▶ | sub dirapp_config_for { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dirapp_config_for: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 0 | (my MY $self, my $yatt_or_app_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 0 | ▶ | unless ($self->{config_dir}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | 0 | Carp::croak "config_dir is empty!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 0 | my $app_name = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 0 | ▶ | if (not ref $yatt_or_app_name) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 0 | $yatt_or_app_name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | } elsif ($self->{use_sibling_config_dir}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 0 | $yatt_or_app_name->rel_app_name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 0 | $yatt_or_app_name->app_name | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 0 | my $base_path = "$self->{config_dir}/$app_name"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 0 | ▶ | my $has_latest_entry = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 0 | my ($dict, $key) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 0 | ▶ | defined (my $prev_entry = $dict->{$key}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 0 | my ($age, $path, $obj) = @$prev_entry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 0 | ▶ | my $new_age = -M $path or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 0 | delete $dict->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 0 | ▶ | $new_age == $age | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | 0 | $prev_entry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 0 | ▶ | if (my $prev_entry = $has_latest_entry->($self->{_dirapp_config}, $base_path)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 0 | $prev_entry->[-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | } elsif (my $cf = $self->find_unique_config_file($base_path)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 0 | my $obj = $self->read_file($cf); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 0 | $self->{_dirapp_config}{$base_path} = [-M $cf, $cf, $obj]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 0 | $obj; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 0 | undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 2 | ▶ | sub site_config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
site_config: called CC=2 SCAR=7.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 2 | (my MY $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 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"}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 2 | $self->examine_site_config; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 2 | $self->{site_config}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 393 | ▶ | sub examine_site_config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
examine_site_config: called CC=8 SCAR=20.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | 393 | (my MY $self, my $con) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 393 | ▶ | if ($con) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | # Cache should be examined at most once for each request. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 391 | my ConnProp $prop = $con->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 391 | ▶ | return if $prop->{_site_config_is_examined}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 385 | ▶ | if (my $cache_entry = $self->{_site_config_cache_entry}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 8 | my ($age, $fn) = @$cache_entry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 8 | my $cur_age = -M $fn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 8 | ▶ | if (not defined $cur_age) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | # Cached file is deleted, so cache should be deleted too. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 0 | delete $self->{_site_config_cache_entry}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | } elsif ($age == $cur_age) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | # Cache is valid. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 4 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | # Examine app.site_config.{yml,xhf} and site_config.{yml,xhf}. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | my ($cf) = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | ($self->{use_sibling_config_dir} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | ? $self->find_unique_config_file($self->{config_dir}, "/site_config") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | : ()), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | # Note: $self->{app_rootname} and $self->{app_root} can be undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | # but find_unique_config_file() can safely ignore undef. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | $self->find_unique_config_file($self->{app_rootname}, ".site_config"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 381 | ▶ | $self->find_unique_config_file($self->{app_root}, "/site_config"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 381 | ▶ | if ($cf) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 10 | $self->{site_config} = $self->read_file($cf); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 10 | $self->{_site_config_cache_entry} = [-M $cf, $cf]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | 10 | $self->site_config_load_hook; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 371 | $self->{site_config} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | 10 | ▶ | sub site_config_load_hook { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
site_config_load_hook: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 10 | (my MY $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 10 | ▶ | if ($self->{site_config_as_entity}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | 10 | my $entns = $self->EntNS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 10 | foreach my $name (keys %{$self->{site_config}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 26 | ▶ | next if $name =~ /\W/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 16 | ▶ | $self->add_entity_into($entns, $name, sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 16 | my MY $actual = $SYS; # To avoid directly capturing $self. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 16 | $actual->{site_config}{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | 18 | }, 1); # Just ignore if already defined. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | 8 | ▶ | Entity site_config => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | 8 | my ($this, $name, $default) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 8 | my MY $self = $SYS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 8 | $SYS->examine_site_config($CON); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 8 | ▶ | return $self->{site_config} unless defined $name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 43 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 2 | ▶ | Entity is_debug_allowed_ip => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | 2 | my ($this, $remote_addr) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | 2 | my MY $self = $SYS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 2 | ▶ | $remote_addr //= do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/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 table33%1/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)
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | 2 | my Env $env = $CON->env; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 2 | $self->guess_client_ip($env); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | 2 | ▶ | $remote_addr && $self->is_debug_allowed_ip($remote_addr) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 43 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 43 | foreach my $name (qw/ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | file_location | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | page_location | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | dir_location | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | is_current_file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | is_current_page | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | file_page | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | site_path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | site_url | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | current_path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | current_url | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | raise_redirect | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | / | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 473 | my $method = $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 662 | ▶ | Entity $method => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | 662 | shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | 662 | $CON->$method(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 473 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 43 | foreach my $item (map([$_ => uc($_)] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | , qw/path_info | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | request_uri | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | script_filename | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | SCRIPT_NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | SCRIPT_URI | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | SCRIPT_URL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | /)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | 258 | my ($method, $env_name) = @$item; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | 0 | ▶ | Entity $method => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | 0 | my Env $env = $CON->env; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 0 | $env->{$env_name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | 258 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | # &yatt:SCRIPT_NAME(); is original $env->{SCRIPT_NAME} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | # &yatt:script_name(); is $env->{'yatt.script_name'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 15 | ▶ | Entity script_name => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | 15 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | 15 | my Env $env = $CON->env; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 15 | $env->{'yatt.script_name'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 43 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | 0 | ▶ | Entity script_dir => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 0 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | 0 | my Env $env = $CON->env; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 0 | $env->{'yatt.script_dir'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | 43 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | # GH-205 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | # &yatt:SCRIPT_URI(); is original $env->{SCRIPT_URI} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | # &yatt:script_uri(); cares HTTP_X_FORWARDED_PROTO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 4 | ▶ | Entity script_uri => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | 4 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | 4 | $CON->mkprefix . $this->entity_script_url; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 43 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | 4 | ▶ | Entity script_url => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 4 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | 4 | my Env $env = $CON->env; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 43 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | # :abspath() - location + file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | 4 | ▶ | Entity abspath => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | 4 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | 4 | my ConnProp $prop = $CON->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | 43 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | 0 | ▶ | Entity abspath_in_siteapp => sub {shift->entity_abspath}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | # :absrequest() - REQUEST_URI - yatt.script_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | # Note: since this value is derived from REQUEST_URI, which do not contain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | # index.yatt typically, this is not suitable to get physical filename. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | 4 | ▶ | Entity absrequest => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | 4 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | 4 | my Env $env = $CON->env; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | 4 | my $url = substr($env->{REQUEST_URI}, length $env->{'yatt.script_name'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | 4 | $url =~ s{\?.*}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | 4 | $url; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | 43 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | 43 | YATT::Lite::Breakpoint::break_load_dispatcher(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | 43 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||