httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@ast.cam.ac.uk (David Robinson)
Subject Re: Maybe I'm being silly but...
Date Mon, 07 Aug 1995 16:03:00 GMT
Rst wrote:
>... it sure looks to me like the "Alias /foo/ /bar/" bug can be cured
>by just stripping trailing slashes off both args (being moderately careful
>to canonicalize "///" to "/" and not the empty string).  Yes?

No.

and also
>I'm not sure I can even duplicate the problem as reported (the worst I
>can get a configuration with "Alias /foo/ /bar/" to do on 0.8.7 is not
>to properly redirect requests for /foo), but doing the strip-slash
>business I described in my earlier note today cures the symptoms I do
>observe.

The actual problem was:
Alias /foo /bar/
where /bar/index.html (or whatever) exists,

then URL:/foo  returns /index.html, instead of /bar/index.html

The fix in 0.8.8 unfortuately introduces more incompatibilities than it fixes;
munging the paths to mask the true bug is not the best solution.

The bug is actually due to using the wrong test for when to redirect
a directory index. It currently tests for a missing PATH_INFO of "/", whereas
it should really test for the URL not ending in "/".

With a request of /foo, PATH_INFO is set to "/" (maybe this is wrong too),
so mod_dir.c does not redirect the request to /foo/. However, the point
of the test and redirect is to ensure that relative links in index.html
'work'; this depends on whether the URL ends in a '/' or not. So testing
the URL would be the 'correct' test anyway. A patch for 0.8.7 is supplied.

The fix in 0.8.8 makes it incompatible with the old NCSA behaviour;
specifically Alias /wom/ /bar/ would not match URL:/wom whereas it did
not previously.

Of course, the answer to the posters question should have been that
he should use
Alias /foo /bar
in preference.

 David.

------------------------ Begin file dir.patch ------------------------------
*** mod_dir.c~	Tue Aug  1 01:46:52 1995
--- mod_dir.c	Mon Aug  7 15:34:51 1995
***************
*** 762,768 ****
  
      if (r->method_number != M_GET) return NOT_IMPLEMENTED;
      
!     if (!r->path_info || *r->path_info != '/') {
          char* ifile = pstrcat (r->pool, r->uri, "/", NULL);
  	table_set (r->headers_out, "Location",
  		   construct_url(r->pool, ifile, r->server));
--- 762,768 ----
  
      if (r->method_number != M_GET) return NOT_IMPLEMENTED;
      
!     if (r->uri[0] == '\0' || r->uri[strlen(r->uri)-1] != '/') {
          char* ifile = pstrcat (r->pool, r->uri, "/", NULL);
  	table_set (r->headers_out, "Location",
  		   construct_url(r->pool, ifile, r->server));
------------------------ Begin file dir.patch ------------------------------

Mime
View raw message