You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Radoslaw Zielinski <ra...@pld-linux.org> on 2006/11/24 12:09:16 UTC

Obtaining URI supplied by the client from a subrequest

Hello,

I'm redirecting to a mod_perl handler with ErrorDocument:

  Order allow,deny
  ErrorDocument 403 /login
  <Location "/login">
    Order deny,allow
    SetHandler modperl
    PerlResponseHandler My::Handler
  </Location>

On an unauthorized request, Apache makes a subrequest served by
My::Handler::handler().  So far, so good.

I need the original URI in the handler.  $r->uri contains "/login",
so does $r->unparsed_uri -- useless.  

Is there any smarter way than this hack?

  my $request_uri = (split /\s/, $r->the_request)[1];

-- 
Radosław Zieliński <ra...@pld-linux.org>

Re: Obtaining URI supplied by the client from a subrequest

Posted by Radoslaw Zielinski <ra...@pld-linux.org>.
Torsten Foertsch <to...@gmx.net> [24-11-2006 12:41]:
> On Friday 24 November 2006 12:09, Radoslaw Zielinski wrote:
[...]
>> Is there any smarter way than this hack?
>>   my $request_uri = (split /\s/, $r->the_request)[1];
> ErrorDocuments are served by internal redirects. So $r->prev->uri should do.

Thanks, $r->prev is exactly what I was looking for.

-- 
Radosław Zieliński <ra...@pld-linux.org>

Re: Obtaining URI supplied by the client from a subrequest

Posted by Torsten Foertsch <to...@gmx.net>.
On Friday 24 November 2006 12:09, Radoslaw Zielinski wrote:
> I'm redirecting to a mod_perl handler with ErrorDocument:
>
>   Order allow,deny
>   ErrorDocument 403 /login
>   <Location "/login">
>     Order deny,allow
>     SetHandler modperl
>     PerlResponseHandler My::Handler
>   </Location>
>
> On an unauthorized request, Apache makes a subrequest served by
> My::Handler::handler().  So far, so good.
>
> I need the original URI in the handler.  $r->uri contains "/login",
> so does $r->unparsed_uri -- useless.  
>
> Is there any smarter way than this hack?
>
>   my $request_uri = (split /\s/, $r->the_request)[1];

ErrorDocuments are served by internal redirects. So $r->prev->uri should do.

Torsten