You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Fran Fabrizio <ff...@mmrd.com> on 2002/08/21 17:01:13 UTC
$r->path_info() getting confused
In my conf file, I have the following directives:
<Location /rms>
AuthType Apache::AuthCookieRMSDBI
AuthName RMS
PerlAuthenHandler Apache::AuthCookieRMSDBI->authenticate
PerlAuthzHandler Apache::AuthCookieRMSDBI->authorize
require valid-user
</Location>
<Location /rms/module>
SetHandler perl-script
PerlHandler RMS::Control::Module->handler
</Location>
When I call the URL /rms/module/foo, and in
RMS::Control::Module->handler I examine $r->path_info, I get as a value
'/module/foo' rather than the expected '/foo'. If apache recognized
that /rms/module/foo was to go to RMS::Control::Module->handler then it
knows that /rms/module is the script name and thus should know that
path_info should be just /foo, right?
Thanks,
Fran
Re: $r->path_info() getting confused
Posted by giorgos zervas <gi...@perlfect.com>.
hi there,
someone asked a similar question a while ago and here the answer that i
gave them... i think it answers your question too.
---- START ----
apache uses a simple technique for determining the path_info. it starts
at your document root and looks for the directory you specified in your
URI. it continues to go deeper in the directory structure until it
encounters a directory(or file) that doesn't exist. when this happens
the path_info is set to rest of the URI (not including the last part
which wasn't found!).
so in your case apache looks for $DOCROOT/debug
this doesn't exist (presumably) in your $DOCROOT. so the path_info is
set to whatever is left, ie nothing!
if you tried to request www.host/debug/foo
the path_info would be /foo (without the /debug part)
if you created a directory called debug inside you docroot and you tried
the previous example then you path_info would be empty.
i hope this doesn't confuse you a a lot!
----- END ----
in your example you request /rms/module/foo
apache looks for /rms in your docroot and /rms is not found.
consequently the path_info is set to the remaining part of the URI, ie
/module/foo
apache doesn't take into consideration Location directives when setting
the path_info as far as i know.
best regards,
giorgos
Fran Fabrizio wrote:
>
> In my conf file, I have the following directives:
>
> <Location /rms>
> AuthType Apache::AuthCookieRMSDBI
> AuthName RMS
> PerlAuthenHandler Apache::AuthCookieRMSDBI->authenticate
> PerlAuthzHandler Apache::AuthCookieRMSDBI->authorize
> require valid-user
> </Location>
>
> <Location /rms/module>
> SetHandler perl-script
> PerlHandler RMS::Control::Module->handler
> </Location>
>
> When I call the URL /rms/module/foo, and in
> RMS::Control::Module->handler I examine $r->path_info, I get as a value
> '/module/foo' rather than the expected '/foo'. If apache recognized
> that /rms/module/foo was to go to RMS::Control::Module->handler then it
> knows that /rms/module is the script name and thus should know that
> path_info should be just /foo, right?
>
> Thanks,
> Fran
Re: $r->path_info() getting confused
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
Fran Fabrizio wrote:
>
> In my conf file, I have the following directives:
>
> <Location /rms>
> AuthType Apache::AuthCookieRMSDBI
> AuthName RMS
> PerlAuthenHandler Apache::AuthCookieRMSDBI->authenticate
> PerlAuthzHandler Apache::AuthCookieRMSDBI->authorize
> require valid-user
> </Location>
>
> <Location /rms/module>
> SetHandler perl-script
> PerlHandler RMS::Control::Module->handler
> </Location>
>
> When I call the URL /rms/module/foo, and in
> RMS::Control::Module->handler I examine $r->path_info, I get as a value
> '/module/foo' rather than the expected '/foo'. If apache recognized
> that /rms/module/foo was to go to RMS::Control::Module->handler then it
> knows that /rms/module is the script name and thus should know that
> path_info should be just /foo, right?
we illustrate this in the cookbook on pp 156-157.
I'm not exactly sure why this happens internally, but its an Apache
thing and not a mod_perl thing. An Alias directive will probably set
things straight for you.
--Geoff
Re: $r->path_info() getting confused
Posted by darren chamberlain <dl...@users.sourceforge.net>.
* Fran Fabrizio <ff...@mmrd.com> [2002-08-21 11:03]:
> <Location /rms>
> </Location>
>
> <Location /rms/module>
> </Location>
>
> When I call the URL /rms/module/foo, and in
> RMS::Control::Module->handler I examine $r->path_info, I get as a value
> '/module/foo' rather than the expected '/foo'. If apache recognized
> that /rms/module/foo was to go to RMS::Control::Module->handler then it
> knows that /rms/module is the script name and thus should know that
> path_info should be just /foo, right?
I would hazard a guess that /rms exists under the document root, but
/rms/modules does not. How path_info is created has more to do with
what the filesystem looks like than what the <Location> blocks look like.
(darren)
--
What is ideology but the rationalisation of a vested interest?