httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r411849 - /httpd/httpd/trunk/modules/mappers/mod_speling.c
Date Mon, 05 Jun 2006 16:19:32 GMT
Author: niq
Date: Mon Jun  5 09:19:32 2006
New Revision: 411849

URL: http://svn.apache.org/viewvc?rev=411849&view=rev
Log:
Apply mod_speling enhancement posted by Olivier Thereaux
(plus teensy weensy tidyup)

Modified:
    httpd/httpd/trunk/modules/mappers/mod_speling.c

Modified: httpd/httpd/trunk/modules/mappers/mod_speling.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_speling.c?rev=411849&r1=411848&r2=411849&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mappers/mod_speling.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_speling.c Mon Jun  5 09:19:32 2006
@@ -36,6 +36,9 @@
  * misspellings of URLs that users might have entered, namely by checking
  * capitalizations. If it finds a match, it sends a redirect.
  *
+ * Sep-1999 Hugo Haas <hugo@w3.org>
+ * o Added a CheckCaseOnly option to check only miscapitalized words.
+ *
  * 08-Aug-1997 <Martin.Kraemer@Mch.SNI.De>
  * o Upgraded module interface to apache_1.3a2-dev API (more NULL's in
  *   speling_module).
@@ -56,6 +59,7 @@
 
 typedef struct {
     int enabled;
+    int case_only;
 } spconfig;
 
 /*
@@ -72,6 +76,7 @@
     spconfig *cfg = apr_pcalloc(p, sizeof(spconfig));
 
     cfg->enabled = 0;
+    cfg->case_only = 0;
     return cfg;
 }
 
@@ -93,24 +98,17 @@
 }
 
 /*
- * Handler for the CheckSpelling directive, which is FLAG.
- */
-static const char *set_speling(cmd_parms *cmd, void *mconfig, int arg)
-{
-    spconfig *cfg = (spconfig *) mconfig;
-
-    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[] =
 {
-    AP_INIT_FLAG("CheckSpelling", set_speling, NULL, OR_OPTIONS,
+    AP_INIT_FLAG("CheckSpelling", ap_set_flag_slot,
+                  (void*)APR_OFFSETOF(spconfig, enabled), OR_OPTIONS,
                  "whether or not to fix miscapitalized/misspelled requests"),
+    AP_INIT_FLAG("CheckCaseOnly", ap_set_flag_slot,
+                  (void*)APR_OFFSETOF(spconfig, case_only), OR_OPTIONS, 
+                 "whether or not to fix only miscapitalized requests"),
     { NULL }
 };
 
@@ -310,7 +308,8 @@
          * simple typing errors are checked next (like, e.g.,
          * missing/extra/transposed char)
          */
-        else if ((q = spdist(bad, dirent.name)) != SP_VERYDIFFERENT) {
+        else if ((cfg->case_only == 0)
+                 && ((q = spdist(bad, dirent.name)) != SP_VERYDIFFERENT)) {
             misspelled_file *sp_new;
 
             sp_new = (misspelled_file *) apr_array_push(candidates);



Mime
View raw message