the attached patch deals somehow with
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id 284>. It makes it
configurable whether mod_speling should ignore requested dotfiles.
Any opinions would be appreciated.
nd
diff -Nur httpd-2.1~/modules/mappers/mod_speling.c httpd-2.1/modules/mappers/mod_speling.c
--- httpd-2.1~/modules/mappers/mod_speling.c
+++ httpd-2.1/modules/mappers/mod_speling.c
@@ -135,13 +135,26 @@
}
/*
- * Handler for the CheckSpelling directive, which is FLAG.
+ * Handler for the CheckSpelling directive
*/
-static const char *set_speling(cmd_parms *cmd, void *mconfig, int arg)
+static const char *set_speling(cmd_parms *cmd, void *mconfig, const char *arg)
{
spconfig *cfg = (spconfig *) mconfig;
- cfg->enabled = arg;
+ if (!strcasecmp(arg, "Off")) {
+ cfg->enabled = 0;
+ }
+ else if (!strcasecmp(arg, "On")) {
+ cfg->enabled = 1;
+ }
+ else if (!strcasecmp(arg, "WithoutDotfiles")) {
+ cfg->enabled = 2;
+ }
+ else {
+ return "CheckSpelling argument must be one of 'On', 'Off' or"
+ "WithoutDotfiles.";
+ }
+
return NULL;
}
@@ -151,8 +164,8 @@
*/
static const command_rec speling_cmds[] =
{
- AP_INIT_FLAG("CheckSpelling", set_speling, NULL, OR_OPTIONS,
- "whether or not to fix miscapitalized/misspelled requests"),
+ AP_INIT_TAKE1("CheckSpelling", set_speling, NULL, OR_OPTIONS,
+ "whether or not to fix miscapitalized/misspelled requests"),
{ NULL }
};
@@ -308,6 +321,12 @@
candidates = apr_array_make(r->pool, 2, sizeof(misspelled_file));
dotloc = ap_ind(bad, '.');
+
+ /* exclude dotfiles if configured so */
+ if (dotloc == 0 && cfg->enabled == 2) {
+ return DECLINED;
+ }
+
if (dotloc == -1) {
dotloc = strlen(bad);
}