From: Jim Jagielski Date: Tue, 10 Aug 2010 19:07:52 +0000 (+0000) Subject: Merge r978903 from trunk: X-Git-Tag: 2.2.17~93 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea6959f55afa084134186ece86c7afeb88b166fa;p=thirdparty%2Fapache%2Fhttpd.git Merge r978903 from trunk: Merge mod_dir fixups to avoid possible ordering issues noted by trawick Submitted by: niq Reviewed/backported by: jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@984168 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/STATUS b/STATUS index db2f4ec07a9..89e850f8dbe 100644 --- a/STATUS +++ b/STATUS @@ -87,12 +87,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - * mod_dir: fold in the two fixups to a single hooked function - to avoid possible ordering issues with other modules - Trunk: http://svn.apache.org/viewvc?view=revision&revision=978903 - 2.2.x: trunk patch works with offset - +1: niq, rpluem, sf, jim - * mod_ssl: use memmove instead of memcpy for overlapping buffers PR 45444 Trunk patch: http://svn.apache.org/viewvc?view=revision&revision=683280 diff --git a/modules/mappers/mod_dir.c b/modules/mappers/mod_dir.c index e3a9537bcb1..ab215ecf537 100644 --- a/modules/mappers/mod_dir.c +++ b/modules/mappers/mod_dir.c @@ -104,9 +104,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; @@ -160,11 +158,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; @@ -298,12 +291,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); } module AP_MODULE_DECLARE_DATA dir_module = {