perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ariel Manzur <hl...@freeweb.com.ar>
Subject Where do I put my code?
Date Tue, 30 May 2000 00:52:09 GMT
Hi..

I need apache to do this: always ask for authentication, accept any
username/password as valid, and set an enviroment variable with the
password, so I can retrieve it on a CGI script later. I wrote this code:

<Perl>
my $r = Apache->request;
my $username = $r->connection->user;
my($ret, $password) = $r->get_basic_auth_pw;

if ($username and $password) {
   @SetEnv = ("PASSWORD", $password);
} else {
   print "HTTP/1.1 401 Authentication required\n";
   print "WWW-Authenticate: Basic realm=\"Protected stuff\"\n";
   print "Content-type: text/html\n\n";
   print "Authorization required";
};
</Perl>

I need to do this on /auth/ on one of the sites, so I put this code on a
.htaccess file, and then I tryed on httpd.conf, inside <Location /auth>
inside the <Virtualhost> for that site, but on all cases I get "<Perl> not
allowed here".

Is my code correct? where should I put it?

Thanks.. Bye.

Ariel.



Mime
View raw message