]> granicus.if.org Git - apache/commitdiff
Split the mod_dir fixup into two parts. The first determines if this
authorRyan Bloom <rbb@apache.org>
Wed, 21 Feb 2001 17:54:41 +0000 (17:54 +0000)
committerRyan Bloom <rbb@apache.org>
Wed, 21 Feb 2001 17:54:41 +0000 (17:54 +0000)
is a MOVED_PERMANANTLY response, and is done from the fixup.  The second
is a handler that redirects to an index.html page.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88263 13f79535-47bb-0310-9956-ffa450edef68

modules/mappers/mod_dir.c

index 1293bd654a8c5006d53ef3f2581bb66a4501d525..4c4be6223974f693501d233a3347cc54dc86452e 100644 (file)
@@ -116,13 +116,9 @@ static void *merge_dir_configs(apr_pool_t *p, void *basev, void *addv)
     return new;
 }
 
-static int handle_dir(request_rec *r)
+static int fixup_dir(request_rec *r)
 {
     dir_config_rec *d;
-    char *dummy_ptr[1];
-    char **names_ptr;
-    int num_names;
-    int error_notfound = 0;
 
     if (r->finfo.filetype != APR_DIR) {
        return DECLINED;
@@ -144,6 +140,23 @@ static int handle_dir(request_rec *r)
                   ap_construct_url(r->pool, ifile, r));
         return HTTP_MOVED_PERMANENTLY;
     }
+    return OK;
+}
+
+static int handle_dir(request_rec *r)
+{
+    dir_config_rec *d;
+    char *dummy_ptr[1];
+    char **names_ptr;
+    int num_names;
+    int error_notfound = 0;
+
+    if (strcmp(r->handler,DIR_MAGIC_TYPE)) {
+        return DECLINED;
+    }
+
+    d = (dir_config_rec *) ap_get_module_config(r->per_dir_config,
+                                               &dir_module);
 
     /* KLUDGE --- make the sub_req lookups happen in the right directory.
      * Fixing this in the sub_req_lookup functions themselves is difficult,
@@ -224,7 +237,10 @@ static int handle_dir(request_rec *r)
 
 static void register_hooks(apr_pool_t *p)
 {
-    ap_hook_fixups(handle_dir,NULL,NULL,APR_HOOK_MIDDLE);
+    static const char * const aszSucc[]={"mod_autoindex.c", NULL};
+
+    ap_hook_fixups(fixup_dir,NULL,NULL,APR_HOOK_MIDDLE);
+    ap_hook_handler(handle_dir,NULL,aszSucc,APR_HOOK_MIDDLE);
 }
 
 module AP_MODULE_DECLARE_DATA dir_module = {