From: Eric Covener Date: Wed, 12 Nov 2008 19:25:03 +0000 (+0000) Subject: change short-lived behavior of "DirectoryIndex None" based on feedback from wrowe: X-Git-Tag: 2.3.0~120 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4fbdf0e354412a1ccddc00608aee99444635525;p=thirdparty%2Fapache%2Fhttpd.git change short-lived behavior of "DirectoryIndex None" based on feedback from wrowe: Doesn't search for anything: DirectoryIndex disabled Does search for literal "disabled": DirectoryIndex disabled foo. DirectoryIndex foo disabled DirectoryIndex disabled disabled Does search: DirectoryIndex disabled.html git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@713462 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/mod_dir.html.en b/docs/manual/mod/mod_dir.html.en index 848c7af0ee5..2ce73e0990a 100644 --- a/docs/manual/mod/mod_dir.html.en +++ b/docs/manual/mod/mod_dir.html.en @@ -68,7 +68,7 @@ Description:List of resources to look for when the client requests a directory Syntax:DirectoryIndex - None | local-url [local-url] ... + disabled | local-url [local-url] ... Default:DirectoryIndex index.html Context:server config, virtual host, directory, .htaccess Override:Indexes @@ -105,8 +105,10 @@ a directory executed if neither index.html or index.txt existed in a directory.

-

A value of "None" prevents mod_dir from - searching for an index.

+

A single argument of "disabled" prevents mod_dir from + searching for an index. An argument of "disabled" will be interpeted + literally if it has any arguments before or after it, even if they are "disabled" + as well.

diff --git a/docs/manual/mod/mod_dir.xml b/docs/manual/mod/mod_dir.xml index fd500dc8344..3e43020bd0f 100644 --- a/docs/manual/mod/mod_dir.xml +++ b/docs/manual/mod/mod_dir.xml @@ -58,7 +58,7 @@ List of resources to look for when the client requests a directory DirectoryIndex - None | local-url [local-url] ... + disabled | local-url [local-url] ... DirectoryIndex index.html server configvirtual host directory.htaccess @@ -95,8 +95,10 @@ a directory executed if neither index.html or index.txt existed in a directory.

-

A value of "None" prevents mod_dir from - searching for an index.

+

A single argument of "disabled" prevents mod_dir from + searching for an index. An argument of "disabled" will be interpeted + literally if it has any arguments before or after it, even if they are "disabled" + as well.

diff --git a/docs/manual/mod/mod_dir.xml.meta b/docs/manual/mod/mod_dir.xml.meta index 773d360b7d6..ff71f9e18d4 100644 --- a/docs/manual/mod/mod_dir.xml.meta +++ b/docs/manual/mod/mod_dir.xml.meta @@ -1,5 +1,4 @@ - mod_dir diff --git a/modules/mappers/mod_dir.c b/modules/mappers/mod_dir.c index d61c2892edd..8dcb0194d72 100644 --- a/modules/mappers/mod_dir.c +++ b/modules/mappers/mod_dir.c @@ -47,13 +47,30 @@ typedef struct dir_config_struct { static const char *add_index(cmd_parms *cmd, void *dummy, const char *arg) { dir_config_rec *d = dummy; - + const char *t, *w; + int count = 0; + if (!d->index_names) { d->index_names = apr_array_make(cmd->pool, 2, sizeof(char *)); } - if (strcasecmp(arg, "none")) { - *(const char **)apr_array_push(d->index_names) = arg; + + t = arg; + while ((w = ap_getword_conf(cmd->pool, &t)) && w[0]) { + if (count == 0 && !strcasecmp(w, "disabled")) { + /* peek to see if "disabled" is first in a series of arguments */ + const char *tt = t; + fprintf(stderr, "t:'%s'\n", t); + const char *ww = ap_getword_conf(cmd->pool, &tt); + if (ww == NULL || !ww[0]) { + /* "disabled" is first, and alone */ + + continue; + } + } + *(const char **)apr_array_push(d->index_names) = w; + count++; } + return NULL; } @@ -67,7 +84,7 @@ static const char *configure_slash(cmd_parms *cmd, void *d_, int arg) static const command_rec dir_cmds[] = { - AP_INIT_ITERATE("DirectoryIndex", add_index, NULL, DIR_CMD_PERMS, + AP_INIT_RAW_ARGS("DirectoryIndex", add_index, NULL, DIR_CMD_PERMS, "a list of file names"), AP_INIT_FLAG("DirectorySlash", configure_slash, NULL, DIR_CMD_PERMS, "On or Off"),