$r->uri('/awstats/awstats.pl');
$r->args("config=$name");
into my authen handler,
the result is /awstats/awstats.pl/?config=$name,
and not /awstats/awstats.pl?config=$name, as it should be.
What do you mean by "result", Petr. please show us the code that you have the problem with.
It is the authentication handler, which must not allow authenticated customers to
view something, that doesn't belong to them:
for instance, customer bob will be allowed to access this:
/awstats/awstats.pl?config=bob
but not this:
/awstats/awstats.pl?config=mary
I'm about to achieve this goal by automatic & default URI redirection in the handler.
Corresponding section in apache.conf follows:
ScriptAlias /awstats "/usr/local/awstats/wwwroot/cgi-bin/" <Directory "/usr/local/awstats/wwwroot/cgi-bin/"> AuthType basic Options -Indexes AuthName "statistiky" Require valid-user PerlAuthenHandler "statauth" </Directory>
The code is here: ------------------------------------------------------------------------------------------------------------------------ package statauth; 1; use strict; use warnings;
use Apache::RequestRec (); use Apache::RequestIO (); use Apache::Access(); use Apache::Const -compile => qw(OK DECLINED HTTP_UNAUTHORIZED);
sub handler { my %pw = ( secret_cz => 'eeheYM7lF3p3g', secret_cz => 'eeqENSaPsG/8I', );
my $r = shift; my ($status, $password) = $r->get_basic_auth_pw; my $name=$r->user(); my $uri = $r->uri(); return $status unless $status == Apache::OK; # return Apache::DECLINED unless $status;
# trying to redirect URI.
# $r->uri('/awstats/awstats.pl'); # here, the uri() method puts the trailing slash. dunno, how to prevent this.
# $r->args("config=$name");
if (crypt($password,'ee') eq $pw{$name}) { return Apache::OK; } else { $r->note_basic_auth_failure; return Apache::HTTP_UNAUTHORIZED; }; $r->content_type('text/html'); return Apache::OK; }
Thank You so much. Petr.
-- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html