]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r978903 from trunk:
authorJim Jagielski <jim@apache.org>
Tue, 10 Aug 2010 19:07:52 +0000 (19:07 +0000)
committerJim Jagielski <jim@apache.org>
Tue, 10 Aug 2010 19:07:52 +0000 (19:07 +0000)
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

STATUS
modules/mappers/mod_dir.c

diff --git a/STATUS b/STATUS
index db2f4ec07a92e041b2e6c987aaa9f54db44495ce..89e850f8dbe5a732520f5f8aaa0451245a3cf2b6 100644 (file)
--- 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
index e3a9537bcb1be4ab3f6606f2f4a190dc8275d305..ab215ecf537a5673b70867644929ea4d5cdf20d3 100644 (file)
@@ -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 = {