Re: handling of the trailing slash

2003-02-04 Thread Stas Bekman
kris nelson wrote:

Apache/1.3.26 + mod_perl/1.27

I've noticed that Apache alone appears to differ from one of my modules
running under mod_perl in its handling of trailing slashes. I'm wondering if
this is expected behavior and, if so, why? (Maybe this is obvious...)

For example: the file news.html exists in /var/www/html/. I issue four
requests to Apache alone, one for /news.html, one for /news, one for
/news/ and one for /news.html/, and then the same four requests again,
this time under mod_perl.

The second time, under mod_perl, I use a basic little module that simply
records the value of $r-filename to the error log and then sends the
contents of the file to the browser (after opening it with Apache::File,
similar to the Ch. 4 Eagle book instructions). (No directory called
/var/www/html//news exists, nor are there any symlinks involved.)

Here's a table of the results:

Apache
---
/news.html	/news	/news/	/news.html/
200		200	404	404

200 means success, data displayed was from news.html. The error log showed
that /news.html/ was not found in the case of the 404s.

Apache+mod_perl
---
/news.html	/news	/news/	/news.html/
200		200	200	200

200 means success, data displayed was from news.html, error_log recorded
/var/www/html/news.html in all cases as the value of $r-filename (thanks
to my little Perl module logging this value for me). In the cases of
/news/ and /news.html/, my relative image links broke (for hopefully
obvious reasons).

Is this expected behavior? Why? I would expect Apache and Apache+mod_perl to
behave similarly. Am I missing something obvious? (Probably...)


It's hard to guess what your relevant configuration is. Care to send in the 
mod_perl and Apache sections? Including things like Multiviews Options, 
DirectoryIndex, etc.

Basically it all comes to the following logic: mod_perl sections inherit all 
the default Apache settings unless you've overriden them. And this is true for 
any other module, be it mod_perl or not.


__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



Re: handling of the trailing slash

2003-02-04 Thread Randal L. Schwartz
 kris == kris nelson [EMAIL PROTECTED] writes:

kris I've noticed that Apache alone appears to differ from one of my
kris modules running under mod_perl in its handling of trailing
kris slashes. I'm wondering if this is expected behavior and, if so,
kris why? (Maybe this is obvious...)

Yes, expected.  mod_core gets upset if there are characters in
PATH_INFO trailing the filename.  But mod_cgi doesn't care, nor does
mod_perl's Apache::Registry.  If you write your own handler, you can
return errors for data in PATH_INFO.  It's up to you.  You didn't say
what handler you were using (hint: mod_perl is never specific enough
:).

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!