Correct a bug if status is configured without localStorage, add a specific ErrorDocument for code 500

This commit is contained in:
Clément Oudot 2009-12-03 15:45:13 +00:00
parent 9d7e1a85c1
commit 6a24eebcc7
5 changed files with 30 additions and 5 deletions

View File

@ -11,7 +11,8 @@ PerlRequire __HANDLER__
</IfModule>
# Common error page and security parameters
ErrorDocument 403 http://auth.__DNSDOMAIN__/error.pl
ErrorDocument 403 http://auth.__DNSDOMAIN__/error.pl?error=403
ErrorDocument 500 http://auth.__DNSDOMAIN__/error.pl?error=500
ServerSignature Off
LogLevel warn

View File

@ -13,7 +13,8 @@ PerlOptions +GlobalRequest
</IfModule>
# Common error page and security parameters
ErrorDocument 403 http://auth.__DNSDOMAIN__/error.pl
ErrorDocument 403 http://auth.__DNSDOMAIN__/error.pl?error=403
ErrorDocument 500 http://auth.__DNSDOMAIN__/error.pl?error=500
ServerSignature Off
LogLevel warn

View File

@ -393,7 +393,12 @@ sub localInit($$) {
$class->purgeCache();
}
if ( $args->{status} ) {
statusProcess();
if ( defined $localStorage ) {
statusProcess();
} else {
# localStorage is mandatory for status module
$class->lmLog("Status module can not be loaded without localStorage parameter", 'warn');
}
}
$class->childInit();
}
@ -1052,7 +1057,10 @@ sub redirectFilter {
sub status($$) {
my ( $class, $r ) = @_;
$class->lmLog( "$class: request for status", 'debug' );
return SERVER_ERROR unless ( $statusPipe and $statusOut );
unless ( $statusPipe and $statusOut ) {
$class->lmLog( "$class: status page can not be displayed" , 'error' );
return SERVER_ERROR;
}
$r->handler("perl-script");
print $statusPipe "STATUS" . ( $r->args ? " " . $r->args : '' ) . "\n";
my $buf;

View File

@ -14,6 +14,12 @@ my $skin = $portal->{portalSkin};
my $portal_url = $portal->{portal};
my $logout_url = "$portal_url?logout=1";
# Which HTTP error?
my $http_error = $portal->param('error');
my $error500 = 1 if ( $http_error eq "500" );
my $error403 = 1 if ( $http_error eq "403" or !$error500 );
my $template = HTML::Template->new(
filename => "$skin_dir/$skin/error.tpl",
die_on_bad_params => 0,
@ -24,6 +30,8 @@ my $template = HTML::Template->new(
$template->param( PORTAL_URL => "$portal_url" );
$template->param( LOGOUT_URL => "$logout_url" );
$template->param( SKIN => "$skin" );
$template->param( ERROR403 => "$error403" );
$template->param( ERROR500 => "$error500" );
print $portal->header('text/html; charset=utf8');
print $template->output;

View File

@ -3,7 +3,14 @@
<div class="loginlogo"></div>
<div id="error">
<h3><lang en="You have no access authorization for this application" fr="Vous n'avez pas les droits d'acc&egrave;s &agrave; cette application" /></h3>
<TMPL_IF ERROR403>
<h3><lang en="You have no access authorization for this application" fr="Vous n'avez pas les droits d'acc&egrave;s &agrave; cette application" /></h3>
</TMPL_IF>
<TMPL_IF ERROR500>
<h3><lang en="Error occurs on the server" fr="Une erreur est survenue sur le serveur" /></h3>
</TMPL_IF>
<div class="buttons">
<a href="<TMPL_VAR NAME="PORTAL_URL">" class="positive">