]> granicus.if.org Git - apache/commitdiff
improve (but preserve searchable parts of) the error message when Options
authorEric Covener <covener@apache.org>
Fri, 15 Jul 2011 22:32:42 +0000 (22:32 +0000)
committerEric Covener <covener@apache.org>
Fri, 15 Jul 2011 22:32:42 +0000 (22:32 +0000)
-Indexes is about to trigger a 403 in mod_autoindex, with a pointer
to mod_dir about how the DirectoryIndex might have been the real culprit.

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

modules/generators/mod_autoindex.c
modules/mappers/mod_dir.c

index fcb0a95ee658afeb569ddc7c5239a8cda2bafde8..3fe825779240c793e55fa4ab4b96c6eaa5ef0c81 100644 (file)
@@ -2308,9 +2308,14 @@ static int handle_autoindex(request_rec *r)
         return index_directory(r, d);
     }
     else {
+        const char *index_names = apr_table_get(r->notes, "dir-index-names");
+
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
-                      "Directory index forbidden by "
-                      "Options directive: %s", r->filename);
+                      "Cannot serve directory %s: No matching DirectoryIndex (%s) found, and "
+                      "server-generated directory index forbidden by "
+                      "Options directive", 
+                       r->filename,
+                       index_names ? index_names : "none");
         return HTTP_FORBIDDEN;
     }
 }
index cb8e0346e88ef39765c6358a48d59a563a0aea98..c7ae2ae5c7adcb293b66d1ded3ba0d835f8623c7 100644 (file)
@@ -346,6 +346,12 @@ static int fixup_dir(request_rec *r)
         return error_notfound;
     }
 
+    /* record what we tried, mostly for the benefit of mod_autoindex */
+    apr_table_set(r->notes, "dir-index-names", 
+                  d->index_names ? 
+                  apr_array_pstrcat(r->pool, d->index_names, ','): 
+                  AP_DEFAULT_INDEX);
+
     /* nothing for us to do, pass on through */
     return DECLINED;
 }