You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Randy Rasmussen <ra...@sabre.com> on 2001/10/10 18:35:33 UTC
Problem with Apache->request
I am having a problem with a module that needs Apache->request.
The module is AuthCookieLDAP. I have a .htaccess (/test2/.htaccess) file
that looks like:
AuthType Apache::AuthCookieLDAP
AuthName SA
PerlAuthenHandler Apache::AuthCookieLDAP->authenticate
PerlAuthzHandler Apache::AuthCookieLDAP->authorize
require valid-user
That in turn reads my httpd.conf file which has the following:
<Files LOGIN>
AuthType Apache::AuthCookieLDAP
AuthName SA
SetHandler perl-script
PerlHandler Apache::AuthCookieLDAP->login
</Files>
PerlModule Apache::AuthCookieLDAP
PerlSetVar SAPath /
PerlSetVar SALoginScript /cgi-bin/login.pl
PerlSetVar SALDAP_DN "o=isp"
PerlSetVar SADBI_DSN "isp"
PerlSetVar SALDAP_SecretKeyFile .../apache/foobar.com.key
PerlSetVar SALDAP_User tesuser
PerlSetVar SALDAP_host host.foobar.com
#PerlSetVar SALDAP_host ldap.foobar.com
PerlSetVar SALDAP_EncryptionType "none"
PerlSetVar SALDAP_SessionLifetime 00-24-00-00
Then it runs the login.pl script which looks like:
#!/usr/bin/perl
#
# $Id: login.pl,v 1.1 2000/07/11 17:03:05 jacob Exp $
use strict;
use 5.004;
use Text::TagTemplate;
use Apache;
my $t = new Text::TagTemplate;
my $r = Apache->request();
my $destination;
my $authcookiereason;
if ( $r->prev() ) { # we are called as a subrequest.
$destination = $r->prev()->args()
? $r->prev()->uri() . '?' . $r->prev->args()
: $r->prev()->uri();
$authcookiereason = $r->prev()->subprocess_env(
'AuthCookieReason' );
} else {
$destination = $r->args( 'destination' );
$authcookiereason = $r->args( 'AuthCookieReason' );
}
$t->add_tag( DESTINATION => $destination );
unless ( $authcookiereason eq 'bad_cookie' ) {
$t->template_file( "../html/login.html" );
} else {
$t->template_file( "../html/login-failed.html" );
}
$r->send_http_header;
print $t->parse_file unless $r->header_only;
When I go to /test2/index.html I get this error:
Can't locate object method "request" via package "Apache" at
.../cgi-bin/login.pl line 16.
[Wed Oct 10 10:43:26 2001] [error] [client 172.28.22.253] Premature end
of script headers: .../cgi-bin/login.pl
Here is the software and versions I have installed:
apache 1.3.20, Apache-AuthCookie-3.00, Apache-AuthCookieLDAP-0.02,
mod_perl-1.26, perl5.005_02
Please help. I have looke all over deja.com, and all of the perl and
mod_perl sites I can think of to no avail.
Thanks in advance,
Randy
Apache::AuthCookieLDAP secret key [was Problem with Apache->request]
Posted by Chris Strom <cs...@cos.com>.
Randy Rasmussen <ra...@sabre.com> writes:
> This worked to some degree. Here is the page I get now.
> Now I get this error:
> [Fri Oct 12 14:17:50 2001] [error] access to /test2/ failed for
> xxx.xxx.xxx.xxx, reason: Apache::AuthCookieLDAP: didn't the secret key from
> for auth realm SA
>
> How does the secret key work and how should I create it?
I'm not familiar with the Apache::AuthCookieLDAP module, so you'd have
to refer to its documentation for details. It may be a word, phrase or
password depending on the module. I'd start with the
SALDAP_SecretKeyFile that you've specified in your httpd.conf:
> > > PerlSetVar SALDAP_SecretKeyFile .../apache/foobar.com.key
See if it exists and verify that the UID under which the web server is
running has permission to access that file.
>
> Apologize for my ignorance.
>
> Randy
>
> Chris Strom wrote:
>
> > Are you running login.pl under Apache::Registry? If not, something like
> > the following should work:
> >
> > Alias /perl/ /home/httpd/perl/
> > PerlModule Apache::Registry
> > <Location /perl>
> > SetHandler perl-script
> > PerlHandler Apache::Registry
> > Options ExecCGI
> > </Location>
> >
> > Then put your login.pl script into /home/httpd/perl and change
> >
> > > PerlSetVar SALoginScript /cgi-bin/login.pl
> >
> > to
> >
> > PerlSetVar SALoginScript /perl/login.pl
> >
> > Randy Rasmussen <ra...@sabre.com> writes:
> >
> > > I am having a problem with a module that needs Apache->request.
> > >
> > > The module is AuthCookieLDAP. I have a .htaccess (/test2/.htaccess) file
> > > that looks like:
> > > AuthType Apache::AuthCookieLDAP
> > > AuthName SA
> > > PerlAuthenHandler Apache::AuthCookieLDAP->authenticate
> > > PerlAuthzHandler Apache::AuthCookieLDAP->authorize
> > > require valid-user
> > >
> > > That in turn reads my httpd.conf file which has the following:
> > > <Files LOGIN>
> > > AuthType Apache::AuthCookieLDAP
> > > AuthName SA
> > > SetHandler perl-script
> > > PerlHandler Apache::AuthCookieLDAP->login
> > > </Files>
> > >
> > > PerlModule Apache::AuthCookieLDAP
> > > PerlSetVar SAPath /
> > > PerlSetVar SALoginScript /cgi-bin/login.pl
> > > PerlSetVar SALDAP_DN "o=isp"
> > > PerlSetVar SADBI_DSN "isp"
> > > PerlSetVar SALDAP_SecretKeyFile .../apache/foobar.com.key
> > > PerlSetVar SALDAP_User tesuser
> > > PerlSetVar SALDAP_host host.foobar.com
> > > #PerlSetVar SALDAP_host ldap.foobar.com
> > > PerlSetVar SALDAP_EncryptionType "none"
> > > PerlSetVar SALDAP_SessionLifetime 00-24-00-00
> > >
> > >
> > > Then it runs the login.pl script which looks like:
> > > #!/usr/bin/perl
> > > #
> > > # $Id: login.pl,v 1.1 2000/07/11 17:03:05 jacob Exp $
> > > use strict;
> > > use 5.004;
> > > use Text::TagTemplate;
> > > use Apache;
> > >
> > > my $t = new Text::TagTemplate;
> > > my $r = Apache->request();
> > >
> > > my $destination;
> > > my $authcookiereason;
> > > if ( $r->prev() ) { # we are called as a subrequest.
> > > $destination = $r->prev()->args()
> > > ? $r->prev()->uri() . '?' . $r->prev->args()
> > > : $r->prev()->uri();
> > > $authcookiereason = $r->prev()->subprocess_env(
> > > 'AuthCookieReason' );
> > > } else {
> > > $destination = $r->args( 'destination' );
> > > $authcookiereason = $r->args( 'AuthCookieReason' );
> > > }
> > > $t->add_tag( DESTINATION => $destination );
> > >
> > > unless ( $authcookiereason eq 'bad_cookie' ) {
> > > $t->template_file( "../html/login.html" );
> > > } else {
> > > $t->template_file( "../html/login-failed.html" );
> > > }
> > >
> > > $r->send_http_header;
> > > print $t->parse_file unless $r->header_only;
> > >
> > >
> > > When I go to /test2/index.html I get this error:
> > > Can't locate object method "request" via package "Apache" at
> > > .../cgi-bin/login.pl line 16.
> > > [Wed Oct 10 10:43:26 2001] [error] [client 172.28.22.253] Premature end
> > > of script headers: .../cgi-bin/login.pl
> > >
> > > Here is the software and versions I have installed:
> > >
> > > apache 1.3.20, Apache-AuthCookie-3.00, Apache-AuthCookieLDAP-0.02,
> > > mod_perl-1.26, perl5.005_02
> > >
> > > Please help. I have looke all over deja.com, and all of the perl and
> > > mod_perl sites I can think of to no avail.
Re: Problem with Apache->request
Posted by Randy Rasmussen <ra...@sabre.com>.
This worked to some degree. Here is the page I get now.
Now I get this error:
[Fri Oct 12 14:17:50 2001] [error] access to /test2/ failed for
xxx.xxx.xxx.xxx, reason: Apache::AuthCookieLDAP: didn't the secret key from
for auth realm SA
How does the secret key work and how should I create it?
Apologize for my ignorance.
Randy
Chris Strom wrote:
> Are you running login.pl under Apache::Registry? If not, something like
> the following should work:
>
> Alias /perl/ /home/httpd/perl/
> PerlModule Apache::Registry
> <Location /perl>
> SetHandler perl-script
> PerlHandler Apache::Registry
> Options ExecCGI
> </Location>
>
> Then put your login.pl script into /home/httpd/perl and change
>
> > PerlSetVar SALoginScript /cgi-bin/login.pl
>
> to
>
> PerlSetVar SALoginScript /perl/login.pl
>
> Randy Rasmussen <ra...@sabre.com> writes:
>
> > I am having a problem with a module that needs Apache->request.
> >
> > The module is AuthCookieLDAP. I have a .htaccess (/test2/.htaccess) file
> > that looks like:
> > AuthType Apache::AuthCookieLDAP
> > AuthName SA
> > PerlAuthenHandler Apache::AuthCookieLDAP->authenticate
> > PerlAuthzHandler Apache::AuthCookieLDAP->authorize
> > require valid-user
> >
> > That in turn reads my httpd.conf file which has the following:
> > <Files LOGIN>
> > AuthType Apache::AuthCookieLDAP
> > AuthName SA
> > SetHandler perl-script
> > PerlHandler Apache::AuthCookieLDAP->login
> > </Files>
> >
> > PerlModule Apache::AuthCookieLDAP
> > PerlSetVar SAPath /
> > PerlSetVar SALoginScript /cgi-bin/login.pl
> > PerlSetVar SALDAP_DN "o=isp"
> > PerlSetVar SADBI_DSN "isp"
> > PerlSetVar SALDAP_SecretKeyFile .../apache/foobar.com.key
> > PerlSetVar SALDAP_User tesuser
> > PerlSetVar SALDAP_host host.foobar.com
> > #PerlSetVar SALDAP_host ldap.foobar.com
> > PerlSetVar SALDAP_EncryptionType "none"
> > PerlSetVar SALDAP_SessionLifetime 00-24-00-00
> >
> >
> > Then it runs the login.pl script which looks like:
> > #!/usr/bin/perl
> > #
> > # $Id: login.pl,v 1.1 2000/07/11 17:03:05 jacob Exp $
> > use strict;
> > use 5.004;
> > use Text::TagTemplate;
> > use Apache;
> >
> > my $t = new Text::TagTemplate;
> > my $r = Apache->request();
> >
> > my $destination;
> > my $authcookiereason;
> > if ( $r->prev() ) { # we are called as a subrequest.
> > $destination = $r->prev()->args()
> > ? $r->prev()->uri() . '?' . $r->prev->args()
> > : $r->prev()->uri();
> > $authcookiereason = $r->prev()->subprocess_env(
> > 'AuthCookieReason' );
> > } else {
> > $destination = $r->args( 'destination' );
> > $authcookiereason = $r->args( 'AuthCookieReason' );
> > }
> > $t->add_tag( DESTINATION => $destination );
> >
> > unless ( $authcookiereason eq 'bad_cookie' ) {
> > $t->template_file( "../html/login.html" );
> > } else {
> > $t->template_file( "../html/login-failed.html" );
> > }
> >
> > $r->send_http_header;
> > print $t->parse_file unless $r->header_only;
> >
> >
> > When I go to /test2/index.html I get this error:
> > Can't locate object method "request" via package "Apache" at
> > .../cgi-bin/login.pl line 16.
> > [Wed Oct 10 10:43:26 2001] [error] [client 172.28.22.253] Premature end
> > of script headers: .../cgi-bin/login.pl
> >
> > Here is the software and versions I have installed:
> >
> > apache 1.3.20, Apache-AuthCookie-3.00, Apache-AuthCookieLDAP-0.02,
> > mod_perl-1.26, perl5.005_02
> >
> > Please help. I have looke all over deja.com, and all of the perl and
> > mod_perl sites I can think of to no avail.
Re: Problem with Apache->request
Posted by Chris Strom <cs...@cos.com>.
Are you running login.pl under Apache::Registry? If not, something like
the following should work:
Alias /perl/ /home/httpd/perl/
PerlModule Apache::Registry
<Location /perl>
SetHandler perl-script
PerlHandler Apache::Registry
Options ExecCGI
</Location>
Then put your login.pl script into /home/httpd/perl and change
> PerlSetVar SALoginScript /cgi-bin/login.pl
to
PerlSetVar SALoginScript /perl/login.pl
Randy Rasmussen <ra...@sabre.com> writes:
> I am having a problem with a module that needs Apache->request.
>
> The module is AuthCookieLDAP. I have a .htaccess (/test2/.htaccess) file
> that looks like:
> AuthType Apache::AuthCookieLDAP
> AuthName SA
> PerlAuthenHandler Apache::AuthCookieLDAP->authenticate
> PerlAuthzHandler Apache::AuthCookieLDAP->authorize
> require valid-user
>
> That in turn reads my httpd.conf file which has the following:
> <Files LOGIN>
> AuthType Apache::AuthCookieLDAP
> AuthName SA
> SetHandler perl-script
> PerlHandler Apache::AuthCookieLDAP->login
> </Files>
>
> PerlModule Apache::AuthCookieLDAP
> PerlSetVar SAPath /
> PerlSetVar SALoginScript /cgi-bin/login.pl
> PerlSetVar SALDAP_DN "o=isp"
> PerlSetVar SADBI_DSN "isp"
> PerlSetVar SALDAP_SecretKeyFile .../apache/foobar.com.key
> PerlSetVar SALDAP_User tesuser
> PerlSetVar SALDAP_host host.foobar.com
> #PerlSetVar SALDAP_host ldap.foobar.com
> PerlSetVar SALDAP_EncryptionType "none"
> PerlSetVar SALDAP_SessionLifetime 00-24-00-00
>
>
> Then it runs the login.pl script which looks like:
> #!/usr/bin/perl
> #
> # $Id: login.pl,v 1.1 2000/07/11 17:03:05 jacob Exp $
> use strict;
> use 5.004;
> use Text::TagTemplate;
> use Apache;
>
> my $t = new Text::TagTemplate;
> my $r = Apache->request();
>
> my $destination;
> my $authcookiereason;
> if ( $r->prev() ) { # we are called as a subrequest.
> $destination = $r->prev()->args()
> ? $r->prev()->uri() . '?' . $r->prev->args()
> : $r->prev()->uri();
> $authcookiereason = $r->prev()->subprocess_env(
> 'AuthCookieReason' );
> } else {
> $destination = $r->args( 'destination' );
> $authcookiereason = $r->args( 'AuthCookieReason' );
> }
> $t->add_tag( DESTINATION => $destination );
>
> unless ( $authcookiereason eq 'bad_cookie' ) {
> $t->template_file( "../html/login.html" );
> } else {
> $t->template_file( "../html/login-failed.html" );
> }
>
> $r->send_http_header;
> print $t->parse_file unless $r->header_only;
>
>
> When I go to /test2/index.html I get this error:
> Can't locate object method "request" via package "Apache" at
> .../cgi-bin/login.pl line 16.
> [Wed Oct 10 10:43:26 2001] [error] [client 172.28.22.253] Premature end
> of script headers: .../cgi-bin/login.pl
>
> Here is the software and versions I have installed:
>
> apache 1.3.20, Apache-AuthCookie-3.00, Apache-AuthCookieLDAP-0.02,
> mod_perl-1.26, perl5.005_02
>
> Please help. I have looke all over deja.com, and all of the perl and
> mod_perl sites I can think of to no avail.
Re: Problem with Apache->request
Posted by Perrin Harkins <pe...@elem.com>.
> I need to find out why Apache->request is not being found and assigning a
> value.
If I had to guess, I'd say your mod_perl is not installed correctly. I
would rebuild Perl, apache, and mod_perl (static, not DSO) and see if that
fixes the problem.
If you want to troubleshoot it more before doing something that drastic, you
could try some of the suggestions in the guide for verifying that you have a
working mod_perl install.
- Perrin
Re: Problem with Apache->request
Posted by Randy Rasmussen <ra...@sabre.com>.
I had already tried this knowing that it would work since Apache::Request is
a different class as Perrin had mentioned in his reply.
I tried Apache::RegistryLoader->request just to see if it would assign a
value to $r and it did but it failed because the value was null.
I need to find out why Apache->request is not being found and assigning a
value. I familiar enough with how the modules work to be able to find out
what the problem is.
Please help,
Thanks,
Randy
Issac Goldstand wrote:
> Try doing my $r=Apache::Request->new($r);
>
> Issac
>
> Internet is a wonderful mechanism for making a fool of
> yourself in front of a very large audience.
> --Anonymous
>
> Moving the mouse won't get you into trouble... Clicking it might.
> --Anonymous
>
> PGP Key 0xE0FA561B - Fingerprint:
> 7E18 C018 D623 A57B 7F37 D902 8C84 7675 E0FA 561B
>
> ----- Original Message -----
> From: "Randy Rasmussen" <ra...@sabre.com>
> To: <mo...@apache.org>
> Sent: Wednesday, October 10, 2001 18:35
> Subject: Problem with Apache->request
>
> > I am having a problem with a module that needs Apache->request.
> >
> > The module is AuthCookieLDAP. I have a .htaccess (/test2/.htaccess) file
> > that looks like:
> > AuthType Apache::AuthCookieLDAP
> > AuthName SA
> > PerlAuthenHandler Apache::AuthCookieLDAP->authenticate
> > PerlAuthzHandler Apache::AuthCookieLDAP->authorize
> > require valid-user
> >
> > That in turn reads my httpd.conf file which has the following:
> > <Files LOGIN>
> > AuthType Apache::AuthCookieLDAP
> > AuthName SA
> > SetHandler perl-script
> > PerlHandler Apache::AuthCookieLDAP->login
> > </Files>
> >
> > PerlModule Apache::AuthCookieLDAP
> > PerlSetVar SAPath /
> > PerlSetVar SALoginScript /cgi-bin/login.pl
> > PerlSetVar SALDAP_DN "o=isp"
> > PerlSetVar SADBI_DSN "isp"
> > PerlSetVar SALDAP_SecretKeyFile .../apache/foobar.com.key
> > PerlSetVar SALDAP_User tesuser
> > PerlSetVar SALDAP_host host.foobar.com
> > #PerlSetVar SALDAP_host ldap.foobar.com
> > PerlSetVar SALDAP_EncryptionType "none"
> > PerlSetVar SALDAP_SessionLifetime 00-24-00-00
> >
> >
> > Then it runs the login.pl script which looks like:
> > #!/usr/bin/perl
> > #
> > # $Id: login.pl,v 1.1 2000/07/11 17:03:05 jacob Exp $
> > use strict;
> > use 5.004;
> > use Text::TagTemplate;
> > use Apache;
> >
> > my $t = new Text::TagTemplate;
> > my $r = Apache->request();
> >
> > my $destination;
> > my $authcookiereason;
> > if ( $r->prev() ) { # we are called as a subrequest.
> > $destination = $r->prev()->args()
> > ? $r->prev()->uri() . '?' . $r->prev->args()
> > : $r->prev()->uri();
> > $authcookiereason = $r->prev()->subprocess_env(
> > 'AuthCookieReason' );
> > } else {
> > $destination = $r->args( 'destination' );
> > $authcookiereason = $r->args( 'AuthCookieReason' );
> > }
> > $t->add_tag( DESTINATION => $destination );
> >
> > unless ( $authcookiereason eq 'bad_cookie' ) {
> > $t->template_file( "../html/login.html" );
> > } else {
> > $t->template_file( "../html/login-failed.html" );
> > }
> >
> > $r->send_http_header;
> > print $t->parse_file unless $r->header_only;
> >
> >
> > When I go to /test2/index.html I get this error:
> > Can't locate object method "request" via package "Apache" at
> > .../cgi-bin/login.pl line 16.
> > [Wed Oct 10 10:43:26 2001] [error] [client 172.28.22.253] Premature end
> > of script headers: .../cgi-bin/login.pl
> >
> > Here is the software and versions I have installed:
> >
> > apache 1.3.20, Apache-AuthCookie-3.00, Apache-AuthCookieLDAP-0.02,
> > mod_perl-1.26, perl5.005_02
> >
> > Please help. I have looke all over deja.com, and all of the perl and
> > mod_perl sites I can think of to no avail.
> >
> > Thanks in advance,
> >
> > Randy
> >
> >
Re: Problem with Apache->request
Posted by Perrin Harkins <pe...@elem.com>.
> Try doing my $r=Apache::Request->new($r);
You're confusing Apache::Request with Apache->request(), which is easy to
do. Apache::Request is a different class, which is part of the libapreq
distribution. Apache->request() returns the current request object
(commonly called $r).
- Perrin
Re: Problem with Apache->request
Posted by Issac Goldstand <ma...@beamartyr.net>.
Try doing my $r=Apache::Request->new($r);
Issac
Internet is a wonderful mechanism for making a fool of
yourself in front of a very large audience.
--Anonymous
Moving the mouse won't get you into trouble... Clicking it might.
--Anonymous
PGP Key 0xE0FA561B - Fingerprint:
7E18 C018 D623 A57B 7F37 D902 8C84 7675 E0FA 561B
----- Original Message -----
From: "Randy Rasmussen" <ra...@sabre.com>
To: <mo...@apache.org>
Sent: Wednesday, October 10, 2001 18:35
Subject: Problem with Apache->request
> I am having a problem with a module that needs Apache->request.
>
> The module is AuthCookieLDAP. I have a .htaccess (/test2/.htaccess) file
> that looks like:
> AuthType Apache::AuthCookieLDAP
> AuthName SA
> PerlAuthenHandler Apache::AuthCookieLDAP->authenticate
> PerlAuthzHandler Apache::AuthCookieLDAP->authorize
> require valid-user
>
> That in turn reads my httpd.conf file which has the following:
> <Files LOGIN>
> AuthType Apache::AuthCookieLDAP
> AuthName SA
> SetHandler perl-script
> PerlHandler Apache::AuthCookieLDAP->login
> </Files>
>
> PerlModule Apache::AuthCookieLDAP
> PerlSetVar SAPath /
> PerlSetVar SALoginScript /cgi-bin/login.pl
> PerlSetVar SALDAP_DN "o=isp"
> PerlSetVar SADBI_DSN "isp"
> PerlSetVar SALDAP_SecretKeyFile .../apache/foobar.com.key
> PerlSetVar SALDAP_User tesuser
> PerlSetVar SALDAP_host host.foobar.com
> #PerlSetVar SALDAP_host ldap.foobar.com
> PerlSetVar SALDAP_EncryptionType "none"
> PerlSetVar SALDAP_SessionLifetime 00-24-00-00
>
>
> Then it runs the login.pl script which looks like:
> #!/usr/bin/perl
> #
> # $Id: login.pl,v 1.1 2000/07/11 17:03:05 jacob Exp $
> use strict;
> use 5.004;
> use Text::TagTemplate;
> use Apache;
>
> my $t = new Text::TagTemplate;
> my $r = Apache->request();
>
> my $destination;
> my $authcookiereason;
> if ( $r->prev() ) { # we are called as a subrequest.
> $destination = $r->prev()->args()
> ? $r->prev()->uri() . '?' . $r->prev->args()
> : $r->prev()->uri();
> $authcookiereason = $r->prev()->subprocess_env(
> 'AuthCookieReason' );
> } else {
> $destination = $r->args( 'destination' );
> $authcookiereason = $r->args( 'AuthCookieReason' );
> }
> $t->add_tag( DESTINATION => $destination );
>
> unless ( $authcookiereason eq 'bad_cookie' ) {
> $t->template_file( "../html/login.html" );
> } else {
> $t->template_file( "../html/login-failed.html" );
> }
>
> $r->send_http_header;
> print $t->parse_file unless $r->header_only;
>
>
> When I go to /test2/index.html I get this error:
> Can't locate object method "request" via package "Apache" at
> .../cgi-bin/login.pl line 16.
> [Wed Oct 10 10:43:26 2001] [error] [client 172.28.22.253] Premature end
> of script headers: .../cgi-bin/login.pl
>
> Here is the software and versions I have installed:
>
> apache 1.3.20, Apache-AuthCookie-3.00, Apache-AuthCookieLDAP-0.02,
> mod_perl-1.26, perl5.005_02
>
> Please help. I have looke all over deja.com, and all of the perl and
> mod_perl sites I can think of to no avail.
>
> Thanks in advance,
>
> Randy
>
>