From b1b5e91608e1e2c26538cc33687230d38ab1322b Mon Sep 17 00:00:00 2001 From: Eric Covener Date: Fri, 15 Jul 2011 22:32:42 +0000 Subject: [PATCH] improve (but preserve searchable parts of) the error message when Options -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 | 9 +++++++-- modules/mappers/mod_dir.c | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/generators/mod_autoindex.c b/modules/generators/mod_autoindex.c index fcb0a95ee6..3fe8257792 100644 --- a/modules/generators/mod_autoindex.c +++ b/modules/generators/mod_autoindex.c @@ -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; } } diff --git a/modules/mappers/mod_dir.c b/modules/mappers/mod_dir.c index cb8e0346e8..c7ae2ae5c7 100644 --- a/modules/mappers/mod_dir.c +++ b/modules/mappers/mod_dir.c @@ -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; } -- 2.40.0