Re: PATH_INFO and SCRIPT_NAME for handlers at root level

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks, Torsten. It looks like that approach will work perfectly for
what I need.


Mike


On Sat, Jul 12, 2008 at 10:26 AM, Torsten Foertsch
<torsten.foertsch@xxxxxxx> wrote:
> On Fri 11 Jul 2008, Mike Friedman wrote:
>> I've got a mod_perl handler setup like so, within a vhost:
>>
>> <Location /myapp>
>>         SetHandler perl-script
>>         PerlResponseHandler MyApp::Dispatcher
>> </Location>
>>
>> Under this setup, if I navigate to /myapp/foo/bar/baz, I get:
>>
>> PATH_INFO => /foo/bar/baz
>> SCRIPT_NAME => /myapp
>>
>> This makes sense. However, if I then change the Location block from
>> /myapp to /, the behavior changes:
>>
>> PATH_INFO => /bar/baz
>> SCRIPT_NAME => /foo
>
> Path_info determination depends on the layout of files and directories on your
> filesystem. I'd advise against using it in anything like a dispatcher. Just
> for fun try to create a regular file /myapp/foo/bar in your docroot and use
> your first setup. You'll see PATH_INFO=/baz.
>
> Instead use $r->location and $r->uri to compute a version of path-info by
> yourself. Something like that:
>
>  $pi=$r->uri;
>  $loc=$r->location;
>  $pi=~s/^\E$loc\Q//;
>
> Torsten
>
> --
> Need professional mod_perl support?
> Just hire me: torsten.foertsch@xxxxxxx
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux