]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge mod_dir fixups to avoid possible ordering issues noted by trawick
authorNick Kew <niq@apache.org>
Sat, 24 Jul 2010 17:12:02 +0000 (17:12 +0000)
committerNick Kew <niq@apache.org>
Sat, 24 Jul 2010 17:12:02 +0000 (17:12 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@978903 13f79535-47bb-0310-9956-ffa450edef68

modules/mappers/mod_dir.c

index 69f6cd9fb226d55e4be0c374f1ccfc32f59c29d4..44ee31116f41cc238aef3ba9d0b40f9b86e622b1 100644 (file)
@@ -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) = {