I think the handling of Location directives, particularly the SetHandler directive
inside
a Location directive is broken. Or perhaps it never worked the way I intuit is should
work. Why should we run directory_walk() if a location_walk() has identified a handler
for the request???
>From my earlier example...
In httpd.conf I have enabled mod_status thusly...
<Location /server-status>
SetHandler server-status
</Location>
A request for http://mymachine/server-status will result in two stats:
stat 1 - %DocumentRoot%/server-status
stat 2 - %DocumentRoot%
Both are in get_path_info() as part of directory_walk(). Why are we even in
directory_walk()???
location_walk() is run BEFORE directory_walk() (see process_request_internal() in
http_request.c). Seems if we find a handler for the request during the first
location_walk, we should skip the call to directory_walk(), no? Skipping
directory_walk
would avoid the stat calls.
One other observation that suggests an alternate solution... the very beginning of
directory_walk() has this check.......
/*
* Are we dealing with a file? If not, we can (hopefuly) safely assume we
* have a handler that doesn't require one, but for safety's sake, and so
* we have something find_types() can get something out of, fake one. But
* don't run through the directory entries.
*/
if (r->filename == NULL) {
r->filename = ap_pstrdup(r->pool, r->uri);
r->finfo.st_mode = 0; /* Not really a file... */
r->per_dir_config = per_dir_defaults;
return OK;
}
This suggests that perhaps the translate hook for mod_status should identify that the
request is not a file and set r->filename = NULL. I am looking at Apache 1.3 but all
this
discussion should apply to Apache 2.0 as well.
Bill