Re: $r-path_info() getting confused

2002-09-07 Thread giorgos zervas

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





$r-path_info() getting confused

2002-08-21 Thread Fran Fabrizio


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

2002-08-21 Thread Geoffrey Young



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

2002-08-21 Thread darren chamberlain

* Fran Fabrizio [EMAIL PROTECTED] [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?



$r-path_info question

2002-07-23 Thread simran

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

2002-07-23 Thread darren chamberlain

* simran [EMAIL PROTECTED] [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



$r-path_info()

2001-07-02 Thread Viljo Marrandi

Hello,

I hope this is the right place to ask this question. I'm using 
Template-Toolkit under Apache/mod_perl and created my own handler for 
it. There is such line in this handler:

my $temp_file = $r-path_info();

When i send this $temp_file to log it works fine:

my $log = $r-log();
$log-notice($temp_file, $r-filename);

But if i try to modify it (eg. $temp_file =~ tr/a-z/A-Z/;) it doesn't do 
nothing. It's still same as in the beginning. What am i doing wrong? It 
should be a regular string so i should be able to modify it...

And if I send $temp_file as variable to process it into template it's empty:

my $vars = {
   filename = $temp_file,}

$template-process($file, $vars, $r)

Any help would be great.

Rgds,
Viljo




$r-path_info() bug?

2000-10-05 Thread Todd Chapman


When I request the following URL with netscape:

http://www.mydomain.com/mason_root/subdir/B/9/abc

The request is handled by a dhandler in /mason_root/subdir


Here is the dhandler:

HTML
HEAD
TITLETest/TITLE
/HEAD
BODY BGCOLOR='white'
This is a test.
P
Path_info: % $r-path_info() %
/BODY
/HTML
 
%init
$r-content_type('text/html');
/%init   


The problem is that the value of path_info is /9/abc when I expect it to
be B/9/abc.

Is the dhandler being treated as B?

HTML::Mason version 0.88

Thanks.

-Todd





Re: $r-path_info() bug?

2000-10-05 Thread Dave Rolsky

On Thu, 5 Oct 2000, Todd Chapman wrote:

 HTML::Mason version 0.88

This isn't related to your question but please be advised that there are
bugs in 0.88 that make upgrading to 0.89 highly advisable.

This question probably belongs on the mason-users list, BTW.  Please see
http://lists.sourceforge.net/mailman/listinfo/mason-users


-dave

/*==
www.urth.org
We await the New Sun
==*/






$r-path_info question

2000-06-27 Thread Drew Taylor

Hi all,

I am using $r-path_info in an Apache handler. The handler is set via a
Location directive:

Location /cgi-bin/detail.pl # Overcoming Legacy code :-)
SetHandler perl-script
PerlHandler eLogix::Images::Detail
/Location

And is called like "/cgi-bin/detail.pl/A1234567.jpg". My question is
this: Since there is no physical filename which corresponds to the URL,
what does path_info contain? In the eagle book on page 135, when
path_info is first discussed, the example uses
$r-lookup_uri($path_info) to get the filename, which in this example is
a purely virtual tree.

I currently am using 

my $filename = (split /\//, $r-path_info)[1];

but it seems like such a hack. What is the "suggested" way to get the
"A1234567.jpg" part of the above URL?

-- 
Drew Taylor
Vialogix Communications, Inc.
501 N. College Street
Charlotte, NC 28202
704 370 0550
http://www.vialogix.com/



Re: $r-path_info question

2000-06-27 Thread David Kenzik

  Drew Taylor said...

  Hi all,

Hi.

  I currently am using 
  
  my $filename = (split /\//, $r-path_info)[1];
  
  but it seems like such a hack. What is the "suggested" way to get the
  "A1234567.jpg" part of the above URL?

Since Apache sets path_info by scanning the physical filesystem, and since
you are overcoming legacy calls to a script inside cgi-bin, your solution is
probably just fine.

I had a similar issue in the past:

http://forum.swarthmore.edu/epigone/modperl/smumbabax

As Doug mentions in that thread, $r-location might be of some assistance.

Hope this helps.

-- 
David S. Kenzik
[EMAIL PROTECTED] - http://kenzik.com



Re: $r-path_info question

2000-06-27 Thread Drew Taylor

David Kenzik wrote:
 
   Drew Taylor said...
  
   I currently am using
  
   my $filename = (split /\//, $r-path_info)[1];
  
   but it seems like such a hack. What is the "suggested" way to get the
   "A1234567.jpg" part of the above URL?
 
 Since Apache sets path_info by scanning the physical filesystem, and since
 you are overcoming legacy calls to a script inside cgi-bin, your solution is
 probably just fine.
 
 I had a similar issue in the past:
 
 http://forum.swarthmore.edu/epigone/modperl/smumbabax
 
 As Doug mentions in that thread, $r-location might be of some assistance.
That was an interesting thread. However, I think Eric found the easiest
solution for me. This handler is very simple and if the requested file
does not pass -e, it just returns NOT_FOUND. So I guess I'll stick with
my original thinking for now.

Thanks.

-- 
Drew Taylor
Vialogix Communications, Inc.
501 N. College Street
Charlotte, NC 28202
704 370 0550
http://www.vialogix.com/



Re: $r-path_info question

2000-06-27 Thread Eric Cholet

 Hi all,
 
 I am using $r-path_info in an Apache handler. The handler is set via a
 Location directive:
 
 Location /cgi-bin/detail.pl # Overcoming Legacy code :-)
 SetHandler perl-script
 PerlHandler eLogix::Images::Detail
 /Location
 
 And is called like "/cgi-bin/detail.pl/A1234567.jpg". My question is
 this: Since there is no physical filename which corresponds to the URL,
 what does path_info contain? In the eagle book on page 135, when
 path_info is first discussed, the example uses
 $r-lookup_uri($path_info) to get the filename, which in this example is
 a purely virtual tree.

$r-path_info contains what's left of the URI after it's been mapped
to a (virtual) file, in your case /A1234567.jpg

 I currently am using 
 
 my $filename = (split /\//, $r-path_info)[1];

or you could have used
  (my $filename = $r-path_info) =~ s!^/!!;

 but it seems like such a hack. What is the "suggested" way to get the
 "A1234567.jpg" part of the above URL?

Since you have no trailing slash in your Location directive,
you get a leading / in path_info. What would be the filename if the
request URI was /cgi-bin/detail.pl/foo/bar.jpg ? In that case 
path_info will be '/foo/bar.jpg'. Maybe what you really want
is 
  my $filename = (split /\//, $r-path_info)[-1];

whatever... it's completely up to the application to define the
semantics of path_info.

 -- 
 Drew Taylor

--
Eric