You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by simran <si...@cse.unsw.edu.au> on 2002/07/23 11:11:48 UTC

$r->path_info question

Hi All, 

If i use hte following configuration:

apache.conf
============

<Location /auto/thumbnails>
  SetHandler  perl-script
  PerlHandler My::Thumbnails
</Location>

Then in my handler sub in Thumbnails.pm do:
==========================================

my $r = instance Apache::Reuest(shift);
print STDERR "PathInfo: "$r->path_info()."\n";


Then i go to the url:
======================

http://localhost/auto/thumbnails/images/a.gif


In my error log i get
======================

PathInfo: /thumbnails/images/a.gif

However: if i create an 'auto' directory in my document root (something
that was not there before)

i get:

PathInfo: /images/a.gif

(which i like :-) 

Is this is feature or a bug, does path_info not check the 'Location' it
matced the handler to or is it meant to look at the directory structure?

simran.

  

Re: $r->path_info question

Posted by darren chamberlain <dl...@users.sourceforge.net>.
* simran <si...@cse.unsw.edu.au> [2002-07-23 05:11]:
> However: if i create an 'auto' directory in my document root
> (something that was not there before)
> 

[-- snip --]

> Is this is feature or a bug, does path_info not check the 'Location' it
> matced the handler to or is it meant to look at the directory structure?

This is how Apache handles path_info: it is the "extra" stuff after
the translation handler has found a directory and filename.  It starts
at the left, and walks towards the right, until it finds the last
component that is a directory, and then the next piece is the file (no
existance check is done at this point).  The rest of it is path_info.

For example:

A request for /foo/bar/baz/quux, with a document root of /document/root
(assuming no Alias directives, that complicates things slightly), and
assuming that /document/root/foo is the last *directory* in the path
that exists, Apache does this:

  1. look for /document -> yep
  2. look for /document/root -> yep
  3. look for /document/root/foo -> yep
  4. look for /document/root/foo/bar -> nope

So /document/root/foo/bar is r->filename, and /baz/quux is path_info.

To reiterate: this is not a mod_perl thing (bug/whatever) but an Apache
one.

(darren)

-- 
An operating system is just a name you give the features you left
out of your editor.
    -- Per Abrahamsen in comp.emacs