Torsten Foertsch wrote:
[...]
The apache-way to do this has a name: ErrorDocument or in mod_perl
$r->custom_response. Configure an ErrorDocument for 403 and return
HTTP_FORBIDDEN in your A...Handler. That has the benefit that the 403
status is logged and that the browser (think about search engines) sees
it. But the custom response page must be larger than 512 bytes or
you'll encounter problems with IE.
> If you don't care about that you can
use $r->internal_redirect. That is a bit less work to do for your
server.
At this moment, I cannot see clearly how the ErrorDocument solution
would allow me to send back a login page created dynamically, as I need
to do. I will look it up, but as a definitive solution for the time
being I would prefer the $r->internal_redirect method, where I can see
more clearly how to do this.
But I still have some (hopefully) last questions, if you would be so kind :
As I understand this, the internal_redirect() basically stops the
current request, and replaces it in-place by a totally new request,
except that in that new request, $r->prev will be set to the (original)
request that did the redirect, right ?
(So in the new request, I can still access the pnotes set by the
original request, via $r->prev->pnotes()).
For this new request, the cycle restarts right at the beginning, and
runs through all the steps just as if this was a main request. Right ?
Are there any other significant differences between this new request and
the previous one that I should be very aware of (in a mod_perl/AAA
context) ?
One thing I do not really understand, is what happens to the original
request, when it issues a call to $r->internal_redirect().
Does the original request still run to completion, or does it "abort"
right there ?
Does Apache still return something to the browser for the original
request, or is that completely replaced by whatever the new (redirected)
request produces ?
After the call to $r->internal_redirect(), should the original request
still do something ? (like return Apache2::Const::?????) ?
Thanks
P.S.
I have downloaded the Apache source, and looked at the code within
httpd-2.x.y/server/request.c, but it is still a bit obscure to me,
except in a very general sense. I kind of approximately follow the
steps, but do not always understand aspects like why it re-does
directory walks at several stages, nor can I see at all where mod_perl
plugs in to that code.