You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2010/08/10 21:07:52 UTC

svn commit: r984168 - in /httpd/httpd/branches/2.2.x: STATUS modules/mappers/mod_dir.c

Author: jim
Date: Tue Aug 10 19:07:52 2010
New Revision: 984168

URL: http://svn.apache.org/viewvc?rev=984168&view=rev
Log:
Merge r978903 from trunk:

Merge mod_dir fixups to avoid possible ordering issues noted by trawick

Submitted by: niq
Reviewed/backported by: jim

Modified:
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/modules/mappers/mod_dir.c

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=984168&r1=984167&r2=984168&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Tue Aug 10 19:07:52 2010
@@ -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

Modified: httpd/httpd/branches/2.2.x/modules/mappers/mod_dir.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/mappers/mod_dir.c?rev=984168&r1=984167&r2=984168&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/mappers/mod_dir.c (original)
+++ httpd/httpd/branches/2.2.x/modules/mappers/mod_dir.c Tue Aug 10 19:07:52 2010
@@ -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 = {