coar 98/08/06 16:32:03
Modified: htdocs/manual/mod mod_speling.html
src/modules/standard mod_speling.c
src CHANGES
Log:
Allow CheckSpelling to be used anywhere, not just at the server
level.
Revision Changes Path
1.9 +27 -12 apache-1.3/htdocs/manual/mod/mod_speling.html
Index: mod_speling.html
===================================================================
RCS file: /export/home/cvs/apache-1.3/htdocs/manual/mod/mod_speling.html,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- mod_speling.html 1998/05/20 14:12:59 1.8
+++ mod_speling.html 1998/08/06 23:31:55 1.9
@@ -70,8 +70,14 @@
<A
HREF="directive-dict.html#Context"
REL="Help"
- ><STRONG>Context:</STRONG></A> server config, virtual host<BR>
+ ><STRONG>Context:</STRONG></A> server config, virtual host,
+ directory, .htaccess<BR>
<A
+ HREF="directive-dict.html#Override"
+ REL="Help"
+ ><STRONG>Override:</STRONG></A> Options
+ <BR>
+ <A
HREF="directive-dict.html#Status"
REL="Help"
><STRONG>Status:</STRONG></A> Base<BR>
@@ -85,20 +91,29 @@
><STRONG>Compatibility:</STRONG></A> CheckSpelling was available as a
separately
available module for Apache 1.1, but was limited to miscapitalizations.
- As of Apache 1.3, it is part of the Apache distribution<!-- or:
- available as a separate module-->.<P>
-
+ As of Apache 1.3, it is part of the Apache distribution. Prior to
+ Apache 1.3.2, the <SAMP>CheckSpelling</SAMP> directive was only available
+ in the "server" and "virtual host" contexts.
+ <P>
This directive enables or disables the spelling module. When enabled,
keep in mind that
+ </P>
<UL>
- <LI>the directory scan which is necessary for the spelling
- correction will have an impact on the server's performance
- when many spelling corrections have to be performed at the same time.
- <LI>the document trees should not contain sensitive files which could
- be matched inadvertently, by a spelling "correction".
- <LI>the module is unable to correct misspelled user names
- (as in <CODE>http://my.host/~apahce/</CODE>), just file names or
- directory names.
+ <LI>the directory scan which is necessary for the spelling
+ correction will have an impact on the server's performance
+ when many spelling corrections have to be performed at the same time.
+ </LI>
+ <LI>the document trees should not contain sensitive files which could
+ be matched inadvertently by a spelling "correction".
+ </LI>
+ <LI>the module is unable to correct misspelled user names
+ (as in <CODE>http://my.host/~apahce/</CODE>), just file names or
+ directory names.
+ </LI>
+ <LI>spelling corrections apply strictly to existing files, so a request
for
+ the <SAMP><Location /status></SAMP> may get incorrectly treated
+ as the negotiated file "<SAMP>/stats.html</SAMP>".
+ </LI>
</UL>
<!--#include virtual="footer.html" -->
1.24 +47 -14 apache-1.3/src/modules/standard/mod_speling.c
Index: mod_speling.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_speling.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- mod_speling.c 1998/08/06 17:31:11 1.23
+++ mod_speling.c 1998/08/06 23:31:59 1.24
@@ -85,31 +85,64 @@
MODULE_VAR_EXPORT module speling_module;
+typedef struct {
+ int enabled;
+} spconfig;
+
+/*
+ * Create a configuration specific to this module for a server or directory
+ * location, and fill it with the default settings.
+ *
+ * The API says that in the absence of a merge function, the record for the
+ * closest ancestor is used exclusively. That's what we want, so we don't
+ * bother to have such a function.
+ */
+
+static void *mkconfig(pool *p)
+{
+ spconfig *cfg = ap_pcalloc(p, sizeof(spconfig));
+
+ cfg->enabled = 0;
+ return cfg;
+}
+
/*
- * We use the "unconventional" mod_userdir approach here. And heck,
- * here it's just one int!
+ * Respond to a callback to create configuration record for a server or
+ * vhost environment.
*/
+static void *create_mconfig_for_server(pool *p, server_rec *s)
+{
+ return mkconfig(p);
+}
-static void *create_speling_config(pool *dummy, server_rec *s)
+/*
+ * Respond to a callback to create a config record for a specific directory.
+ */
+static void *create_mconfig_for_directory(pool *p, char *dir)
{
- return (void *) 0;
+ return mkconfig(p);
}
-static const char *set_speling(cmd_parms *cmd, void *dummy, int arg)
+/*
+ * Handler for the CheckSpelling directive, which is FLAG.
+ */
+static const char *set_speling(cmd_parms *cmd, void *mconfig, int arg)
{
- void *server_conf = cmd->server->module_config;
+ spconfig *cfg = (spconfig *) mconfig;
- /* any non-NULL pointer means speling is enabled */
- ap_set_module_config(server_conf, &speling_module,
- arg ? (void *) &speling_module : NULL);
+ cfg->enabled = arg;
return NULL;
}
+/*
+ * Define the directives specific to this module. This structure is
referenced
+ * later by the 'module' structure.
+ */
static const command_rec speling_cmds[] =
{
- {"CheckSpelling", set_speling, NULL, RSRC_CONF, FLAG,
- "whether or not to fix miscapitalized/misspelled requests"},
- {NULL}
+ { "CheckSpelling", set_speling, NULL, OR_OPTIONS, FLAG,
+ "whether or not to fix miscapitalized/misspelled requests" },
+ { NULL }
};
typedef enum {
@@ -481,9 +514,9 @@
{
STANDARD_MODULE_STUFF,
NULL, /* initializer */
- NULL, /* create per-dir config */
+ create_mconfig_for_directory, /* create per-dir config */
NULL, /* merge per-dir config */
- create_speling_config, /* server config */
+ create_mconfig_for_server, /* server config */
NULL, /* merge server config */
speling_cmds, /* command table */
NULL, /* handlers */
1.1009 +3 -0 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.1008
retrieving revision 1.1009
diff -u -r1.1008 -r1.1009
--- CHANGES 1998/08/06 19:23:41 1.1008
+++ CHANGES 1998/08/06 23:32:01 1.1009
@@ -1,5 +1,8 @@
Changes with Apache 1.3.2
+ *) Enhance mod_spelling so that CheckSpelling can be used in
+ <Directory> containers and .htaccess files. [Ken Coar]
+
*) API: new ap_custom_response() function for hooking into the
ErrorDocument mechanism at runtime [Doug MacEachern]