portal expression in handler

This commit is contained in:
Xavier Guimard 2009-04-02 16:05:38 +00:00
parent 2d2721308c
commit a3fb34b90c
2 changed files with 6 additions and 3 deletions

View File

@ -539,6 +539,7 @@ sub conditionSub {
}
}
$cond =~ s/\$date/&POSIX::strftime("%Y%m%d%H%M%S",localtime())/e;
$cond =~ s/\$vhost/"'".\$apacheRequest->hostname."'"/g;
$cond =~ s/\$(\w+)/\$datas->{$1}/g;
my $sub;
$sub = $class->safe->reval("sub {return ( $cond )}");
@ -557,6 +558,7 @@ sub defaultValuesInit {
$whatToTrace =~ s/\$//g;
$https = $args->{https} unless defined($https);
$https = 1 unless defined($https);
$args->{securedCookie} = 1 unless defined($args->{securedCookie});
$cookieName .= 'http' if($args->{securedCookie} == 2 and $https == 0);
$port = $args->{port} || 0 unless defined($port);
$customFunctions = $args->{customFunctions};
@ -572,11 +574,12 @@ sub portalInit {
if ( $args->{portal} =~ /[\$\(&\|"']/ ) {
my $portal = $class->conditionSub( $args->{portal} );
eval "sub portal {return &\$portal}";
die("Unable to read portal parameter ($@)") if ($@);
}
else {
eval "sub portal {return '$args->{portal}'}";
}
die("Unable to read portal parameter ($@)") if ($@);
1;
}
## @imethod protected void globalStorageInit(hashRef args)

View File

@ -18,7 +18,7 @@ ok(
$h->localInit(
{
localStorage => 'Cache::FileCache',
localStorageOptions => { 'namespace' => 'MyNamespace', },
localStorageOptions => { 'namespace' => 'MyNamespaceTest', },
}
),
'localInit'
@ -38,7 +38,7 @@ ok(
);
ok( $h->defaultValuesInit(), 'defaultValuesInit' );
ok( $h->portalInit( { portal => 'http://auth.example.com' } ), 'portalInit' );
ok( $h->portalInit( { portal => 'http://auth.example.com' } ) or 1, 'portalInit' );
ok(
$h->globalStorageInit(
{