You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Paul Sutton <pa...@ukweb.com> on 1996/10/07 16:15:44 UTC
Poss. bug in directory_walk
I think there is a possible bug in directory_walk. If the request is for a
directory which ends with a /, any .htaccess file in that directory gets
merged _twice_. The reason for this is that the directory walk first finds
the number of dir segments in the path (with count_dirs(), which just
counts the number of /'s), then if the path is a directory, it adds 1. So
requests for
/usr/www/1/index.html
and
/usr/www/1
are regarded as having 4 directories (correct), but
/usr/www/1/
has 5 directories (incorrect). The directories are then processed by
directory_walk:
1 /
2 /usr
3 /usr/www
4 /usr/www/1
5 /usr/www/1/
4 and 5 refer to the same directory, and any .htaccess in this directory
will be included twice. I guess there might be a good reason for this, but
merging a per-dir config twice might cause unwanted effects.
A fix for this is given below.
Paul
UK Web Ltd
*** ../src/http_request.c Thu Aug 22 08:36:53 1996
--- ./http_request.c Mon Oct 7 15:09:25 1996
***************
*** 271,276 ****
--- 271,279 ----
no2slash (test_filename);
num_dirs = count_dirs(test_filename);
get_path_info (r);
+
+ if (test_filename[strlen(test_filename)-1] == '/')
+ --num_dirs;
if (S_ISDIR (r->finfo.st_mode)) ++num_dirs;