From: Nick Kew Date: Sat, 24 Jul 2010 17:12:02 +0000 (+0000) Subject: Merge mod_dir fixups to avoid possible ordering issues noted by trawick X-Git-Tag: 2.3.7~59 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4ace82f934efd0b24fefca4c7b0797dcf4bd9e45;p=thirdparty%2Fapache%2Fhttpd.git Merge mod_dir fixups to avoid possible ordering issues noted by trawick git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@978903 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/mappers/mod_dir.c b/modules/mappers/mod_dir.c index 69f6cd9fb22..44ee31116f4 100644 --- a/modules/mappers/mod_dir.c +++ b/modules/mappers/mod_dir.c @@ -121,9 +121,7 @@ static int fixup_dflt(request_rec *r) const char *name_ptr; request_rec *rr; int error_notfound = 0; - if ((r->finfo.filetype != APR_NOFILE) || (r->handler != NULL)) { - return DECLINED; - } + name_ptr = d->dflt; if (name_ptr == NULL) { return DECLINED; @@ -177,11 +175,6 @@ static int fixup_dir(request_rec *r) int num_names; int error_notfound = 0; - /* only handle requests against directories */ - if (r->finfo.filetype != APR_DIR) { - return DECLINED; - } - /* In case mod_mime wasn't present, and no handler was assigned. */ if (!r->handler) { r->handler = DIR_MAGIC_TYPE; @@ -311,12 +304,22 @@ static int fixup_dir(request_rec *r) /* nothing for us to do, pass on through */ return DECLINED; } +static int dir_fixups(request_rec *r) +{ + if (r->finfo.filetype == APR_DIR) { + /* serve up a directory */ + return fixup_dir(r); + } + else if ((r->finfo.filetype == APR_NOFILE) && (r->handler == NULL)) { + /* No handler and nothing in the filesystem - use fallback */ + return fixup_dflt(r); + } + return DECLINED; +} static void register_hooks(apr_pool_t *p) { - /* the order of these is of no consequence */ - ap_hook_fixups(fixup_dir,NULL,NULL,APR_HOOK_LAST); - ap_hook_fixups(fixup_dflt,NULL,NULL,APR_HOOK_LAST); + ap_hook_fixups(dir_fixups,NULL,NULL,APR_HOOK_LAST); } AP_DECLARE_MODULE(dir) = {