You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2004/05/04 17:15:02 UTC

DO NOT REPLY [Bug 28769] New: - MultiViews on, /partial should return /partial.* in preference to /partial/

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28769>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28769

MultiViews on, /partial should return /partial.* in preference to /partial/

           Summary: MultiViews on, /partial should return /partial.* in
                    preference to /partial/
           Product: Apache httpd-1.3
           Version: 1.3.29
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Other mods
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: kozakzs@primposta.com


This bug was submitted in 2000 (by Francis Daly) into the old bugs.apache.org
database, and has not been resolved yet. So I resubmit it into this new database.


Given the directory structure

/dir/index.html
/part/index.html
/part.html

With a default configuration, the uri's
/dir/, /dir, /part/, /part, and /part.html are handled correctly.

With MultiViews on, I think that the Right Thing is for /part to
be equivalent to /part.html, not /part/ (/dir is still equivalent to
/dir/, because there isn't a dir.*)

[ mod_speling may be induced to do this in this specific case, but add an
*.html.en and a *.html.de for each *.html there, and the point remains ]
Is my idea of the Right Thing, the Wrong Thing?

>How-To-Repeat:
Create the directories dir and part, and the files dir/index.html,
part/index.html and part.html
Set DirectoryIndex to index.html (or index) and turn MultiViews on.
Then issue the requests

GET /dir
GET /dir/
GET /part.html
GET /part/
GET /part

I think the last redirection shouldn't be the same as the first one.

>Fix:
What I suggest is to change the MultiViews documentation from:

A MultiViews search is enabled by the MultiViews Option. If the server
receives a request for /some/dir/foo and /some/dir/foo does not exist,
then the server reads the directory looking for all files named foo.*,
and effectively fakes up a type map which names all those files, assigning
them the same media types and content-encodings it would have if the
client had asked for one of them by name. It then chooses the best match
to the client's requirements, and returns that document.

to:

A MultiViews search is enabled by the MultiViews Option. If the server
receives a request for /some/dir/foo and /some/dir/foo does not exist
or is a directory, then the server reads the directory /some/dir
looking for all files named foo.* and effectively fakes up a type map
which names all those files, assigning them the same media types and
content-encodings it would have if the client had asked for one of them
by name. It then chooses the best match to the client's requirements,
and returns that document. If there isn't a best match, and foo is a
directory, it redirects to /some/dir/foo/.

and to change the code in mod_negotiation.c accordingly:

diff -C3 mod_negotiation.c.old mod_negotiation.c

*** mod_negotiation.c.old       Mon Feb  3 18:13:29 2003
--- mod_negotiation.c   Tue May  4 17:00:42 2004
***************
*** 2656,2662 ****
      int res;
      int j;
  
!     if (r->finfo.st_mode != 0 || !(ap_allow_options(r) & OPT_MULTI)) {
          return DECLINED;
      }
  
--- 2656,2664 ----
      int res;
      int j;
  
!      if ( r->uri[strlen(r->uri)-1] == '/'
!               || !(ap_allow_options(r) & OPT_MULTI)
!             || (r->finfo.st_mode != 0) && !S_ISDIR(r->finfo.st_mode)) {
          return DECLINED;
      }

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org