Actually I think I got it, but thanks for the tip on $r->prev->notes.
I'll have to give it a try.  And yes, I've been poring over the cookbook
for most of the day :)

Here's what I ended up doing: When I hit a place in my authen module
that required me to do:

$r->note_basic_failure;
return AUTH_REQUIRED;

I would instead do:

$r->handler('perl-script');
$r->set_handlers('PerlHandler' => ['AuthFailure']);
return OK;

Then in AuthFailure I have this:

$r->note_basic_auth_failure;
$r->content_type('text/html; charset=ISO-8859-1');
$r->status(401);
$r->send_http_header;

So far it seems to be working fine, and my notes() are coming across.

Brian


-----Original Message-----
From: Geoffrey Young [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 19, 2003 2:23 PM
To: Hann, Brian
Cc: [EMAIL PROTECTED]
Subject: Re: notes() and mod_perl ErrorDocuments




Hann, Brian wrote:
> I have a mod_perl handler set as the 401 ErrorDocument for a certain
> location that requires authentication.  I would like to store data in 
> notes() in the first location so that the 401 handler can access them.

> Is that possible? So far I haven't been able to get it to work.  

try $r->prev->notes

> If it
> is not, is there some way I could internally mimic Apache's 
> authentication challenge/response setup?  For instance, what happens 
> when you return AUTH_REQUIRED to Apache?  

this is all explained in chapter 13 in the cookbook, as well as in the
eagle 
book.  for an example of plugging into authentication, see

http://www.modperlcookbook.org/code/ch13/Cookbook/Authenticate.pm

> Is it possible to do this
> inside a mod_perl handler by using set_handlers()?

well, not really.  unfortunately, you can't just set or push
authentication, 
since Apache skips it unless you have a Require directive attached to
the 
ErrorDocument.

HTH

--Geoff



Reply via email to