On Thu 10 Jan 2008, Vegard Vesterheim wrote:
> The problem I encounter is that the authenticated user is not
> propagated into to the subrequest, so my auth-handler can not do its
> job. The following code is from Apache2::AuthCookie.pm:
>
>     unless ($r->is_initial_req) {
>         if (defined $r->prev) {
>             # we are in a subrequest.  Just copy user from previous
> request.     $r->user( $r->prev->user );
>
> I observe that $r->is_initial_req is false (as it should be), but
> $r->prev is undefined, so the authenticated user is not copied into
> the request record. I have verified that the authenticated username
> is available via $r->main->user.
>
> Why does $r->prev return undef in this case?
>
> Would it be ok to copy the autenticated username from $r->main->user
> instead here?

yes.

is_initial_req() is literally the same as (!$r->main and !$r->prev), see 
server/request.c (httpd-source).

If $r->main is set the current req is a subrequest generated by lookup_uri() 
or lookup_file(). If $r->prev is set it is an internal redirect generated by 
internal_redirect() & co.

Torsten

Reply via email to