People sometimes forget # is a valid character and not a comment starter if not
at the begining of a line.
I've had a report of someone using a configuration like:
DirectoryIndex index.html index.shtml index.cgi index.pl #index.php
index.xhtml
then requiring that apache -t should warn about # in the middle of a line.
While I disagree about the # warning, that invalid configuration is not obvious
to diagnose. Error log will contain things like:
[Sun Aug 04 14:26:34.446796 2013] [core:error] [pid 28134:tid 3019877184]
[client ::1:59082] AH00125: Request exceeded the limit of 10 subrequest nesting
levels due to probable configuration error. Use 'LimitInternalRecursion' to
increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
I think having a directory index url starting with # doesn't make sense.
Don't you think it would be a good idea to forbid that? [patch attached]
Or at least to issue a warning?
Or at least in a mod_dir check_config hook for -t usage?
diff --git a/modules/mappers/mod_dir.c b/modules/mappers/mod_dir.c
index 4364ff9..e081d95 100644
--- a/modules/mappers/mod_dir.c
+++ b/modules/mappers/mod_dir.c
@@ -72,6 +72,9 @@ static const char *add_index(cmd_parms *cmd, void *dummy, const char *arg)
break;
}
}
+ if (*w == '#')
+ return apr_pstrcat(cmd->pool,
+ "index '", w, "' would cause infinite recursion", NULL);
*(const char **)apr_array_push(d->index_names) = w;
count++;
}