Location, filename, path_info
Hey ho
I have a simple configuration:
PerlModule Test::FH
<Location /xyz/abc>
SetHandler perl-script
PerlResponseHandler Test::FH
</Location>
Now I go to the URL http://www.myhost.com/xyz/abc/qqq/123
Inside my code I want to get "/ggg/123" so I try
print "Request: " . $r->path_info . "\n";
This returns "/abc/ggg/123"
Now it always drops the top level "/xyz" - assumably because it is
effectively a file in the root directory.
One way to fix it is to create all the directories, but not too many.
Now what I really want is anything after what ever the location that
the handler is set in.
I can achieve this with a variable that sets the location, but that
seemed a little redundant.
Effectively I am creating a "virtual" location.
Is there a way I can configure or get the Location ?
Ta
Scott
--
* - * http://www.osdc.com.au - Open Source Developers Conference * - *
Scott Penrose
VP in charge of Pancakes
http://linux.dd.com.au/
scottp [at] dd.com.au
Dismaimer: If you receive this email in error - please eat it
immediately to prevent it from falling into the wrong hands.
Please do not send me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
Microsoft is not the answer. It's the question. And the answer is no.
Re: Location, filename, path_info
Scott Penrose wrote:
> Hey ho
>
> I have a simple configuration:
>
> PerlModule Test::FH
> <Location /xyz/abc>
> SetHandler perl-script
> PerlResponseHandler Test::FH
> </Location>
>
> Now I go to the URL http://www.myhost.com/xyz/abc/qqq/123
>
> Inside my code I want to get "/ggg/123" so I try
>
> print "Request: " . $r->path_info . "\n";
>
> This returns "/abc/ggg/123"
> Now it always drops the top level "/xyz" - assumably because it is
> effectively a file in the root directory.
Are you saying that /xyz does exist in your document root? I've found that
Apache won't work if you mix a virtual directory, real directory and path_info.
This is because PATH_INFO is what ever is left over after url => file name
mapping. If there's no real file, then apache removes the <Location> value, else
it removes the part that is a real file/directory.
If you want a virtual directory, make sure that there are no real directories of
the same name.
--
Michael Peters
Developer
Plus Three, LP
Re: Location, filename, path_info
On 31/07/2006, at 23:15, Michael Peters wrote:
> Are you saying that /xyz does exist in your document root? I've
> found that
> Apache won't work if you mix a virtual directory, real directory
> and path_info.
>
> This is because PATH_INFO is what ever is left over after url =>
> file name
> mapping. If there's no real file, then apache removes the
> <Location> value, else
> it removes the part that is a real file/directory.
>
> If you want a virtual directory, make sure that there are no real
> directories of
> the same name.
Sounds like I am experiencing this problem. Another way of explaining
this is using ScriptAlias - if I was using standard CGI I could do
this...
ScriptAlias /xyz/abc /usr/lib/cgi-bin/test-fm.pl
And now it will work perfectly. It does not matter if directories
exist or not.
e.g. http://www.myhost.com/xyz/abc/qqq/123
Now has PATH_INFO set to "/qqq/123". You can create in DocumentRoot
"xyz" and even "xyz/abc" and even "xyz/abc/qqq" and it still sets
PATH_INFO to "/qqq/123"
However this is not the case using "<Location>" which does make sense
but...
So another way of putting my question is - how do I use a Perl Module
instead of a ScriptAlias (CGI Script) and get the same results from
path_info.
Ta
Scott
--
* - * http://www.osdc.com.au - Open Source Developers Conference * - *
Scott Penrose
VP in charge of Pancakes
http://linux.dd.com.au/
scottp [at] dd.com.au
Dismaimer: If you receive this email in error - please eat it
immediately to prevent it from falling into the wrong hands.
Please do not send me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
Microsoft is not the answer. It's the question. And the answer is no.