httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <...@jaguNET.com>
Subject Re: [PATCH] ShowSpellingAlternates
Date Sat, 24 Jun 2000 22:29:12 GMT
+1

Jim Winstead wrote:
> 
> 
> --vkogqOf2sHV7VnPd
> Content-Type: text/plain; charset=us-ascii
> 
> This provides a directive that can be used to turn off the feature
> of mod_speling that sends a 300 (MULTIPLE_CHOICES) response when
> more than one match is found for a misspelling.
> 
> Documentation included with the 1.3 patch (which has been tested
> and is being used at HomePage.com), and the 2.0 patch has only been
> tested to compile (but is, again, simple enough to be unlikely to
> not actually work).
> 
> Jim
> 
> --vkogqOf2sHV7VnPd
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: attachment; filename="patch-speling-1.3"
> 
> diff -ur apache_1.3.12-orig/htdocs/manual/mod/mod_speling.html apache_1.3.12/htdocs/manual/mod/mod_speling.html
> --- apache_1.3.12-orig/htdocs/manual/mod/mod_speling.html	Wed Feb 23 15:11:39 2000
> +++ apache_1.3.12/htdocs/manual/mod/mod_speling.html	Sat Jun 24 13:57:40 2000
> @@ -60,6 +60,7 @@
>  
>    <MENU>
>    <LI><A HREF="#checkspelling">CheckSpelling</A>
> +  <LI><A HREF="#showspellingalternates">ShowSpellingAlternates</A>
>    </MENU>
>  
>    <HR> <!-- the HR is part of the directive description -->
> @@ -121,6 +122,46 @@
>         as the negotiated file "<SAMP>/stats.html</SAMP>".
>     </LI>
>    </UL>
> +
> +  <HR> <!-- the HR is part of the directive description -->
> +  <H2><A NAME="showspellingalternates">ShowSpellingAlternates</A></H2>
> +  <!--%plaintext &lt;?INDEX {\tt ShowSpellingAlternates} directive&gt; -->
> +  <A
> +   HREF="directive-dict.html#Syntax"
> +   REL="Help"
> +  ><STRONG>Syntax:</STRONG></A> ShowSpellingAlternates <EM>on/off</EM><BR>
> +  <A
> +   HREF="directive-dict.html#Default"
> +   REL="Help"
> +  ><STRONG>Default:</STRONG></A> <CODE>ShowSpellingAlternates
On</CODE><BR>
> +  <A
> +   HREF="directive-dict.html#Context"
> +   REL="Help"
> +  ><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>
> +  <A
> +   HREF="directive-dict.html#Module"
> +   REL="Help"
> +  ><STRONG>Module:</STRONG></A> mod_speling<BR>
> +  <A
> +   HREF="directive-dict.html#Compatibility"
> +   REL="Help"
> +  ><STRONG>Compatibility:</STRONG></A> ShowSpellingAlternates was
> +  added in Apache 1.3.13. 
> +  <P>
> +  This directive enables or disables the sending of 300 (MULTIPLE_CHOICE)
> +  responses when multiple alternatives are found for a misspelling
> +  caught by the spelling module.
> +  </P>
>  
>  <HR>
>  
> diff -ur apache_1.3.12-orig/src/modules/standard/mod_speling.c apache_1.3.12/src/modules/standard/mod_speling.c
> --- apache_1.3.12-orig/src/modules/standard/mod_speling.c	Wed Feb 16 09:31:16 2000
> +++ apache_1.3.12/src/modules/standard/mod_speling.c	Sat Jun 24 13:53:41 2000
> @@ -87,6 +87,7 @@
>  
>  typedef struct {
>      int enabled;
> +    int alternates;
>  } spconfig;
>  
>  /*
> @@ -103,6 +104,7 @@
>      spconfig *cfg = ap_pcalloc(p, sizeof(spconfig));
>  
>      cfg->enabled = 0;
> +    cfg->alternates = 1;
>      return cfg;
>  }
>  
> @@ -135,6 +137,17 @@
>  }
>  
>  /*
> + * Handler for the ShowSpellingAlternates directive, which is FLAG.
> + */
> +static const char *set_speling_alternates(cmd_parms *cmd, void *mconfig, int arg)
> +{
> +    spconfig *cfg = (spconfig *) mconfig;
> +
> +    cfg->alternates = arg;
> +    return NULL;
> +}
> +
> +/*
>   * Define the directives specific to this module.  This structure is referenced
>   * later by the 'module' structure.
>   */
> @@ -142,6 +155,8 @@
>  {
>      { "CheckSpelling", set_speling, NULL, OR_OPTIONS, FLAG,
>        "whether or not to fix miscapitalized/misspelled requests" },
> +    { "ShowSpellingAlternates", set_speling_alternates, NULL, OR_OPTIONS, FLAG,
> +      "whether to show lists of alternates for misspelled requested" },
>      { NULL }
>  };
>  
> @@ -428,7 +443,7 @@
>           * Otherwise, a "[300] Multiple Choices" list with the variants is
>           * returned.
>           */
> -        else {
> +        else if (cfg->alternates) {
>              pool *p;
>              table *notes;
>  	    pool *sub_pool;
> 
> --vkogqOf2sHV7VnPd
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: attachment; filename="patch-speling-2.0"
> 
> diff -ur apache_2.0a4-orig/src/modules/standard/mod_speling.c apache_2.0a4/src/modules/standard/mod_speling.c
> --- apache_2.0a4-orig/src/modules/standard/mod_speling.c	Sat May 27 15:40:37 2000
> +++ apache_2.0a4/src/modules/standard/mod_speling.c	Sat Jun 24 14:18:10 2000
> @@ -91,6 +91,7 @@
>  
>  typedef struct {
>      int enabled;
> +    int alternates;
>  } spconfig;
>  
>  /*
> @@ -107,6 +108,7 @@
>      spconfig *cfg = ap_pcalloc(p, sizeof(spconfig));
>  
>      cfg->enabled = 0;
> +    cfg->alternates = 1;
>      return cfg;
>  }
>  
> @@ -139,6 +141,17 @@
>  }
>  
>  /*
> + * Handler for the ShowSpellingAlternates directive, which is FLAG.
> + */
> +static const char *set_speling_alternates(cmd_parms *cmd, void *mconfig, int arg)
> +{
> +    spconfig *cfg = (spconfig *) mconfig;
> +
> +    cfg->alternates = arg;
> +    return NULL;
> +}
> +
> +/*
>   * Define the directives specific to this module.  This structure is referenced
>   * later by the 'module' structure.
>   */
> @@ -146,6 +159,8 @@
>  {
>      { "CheckSpelling", set_speling, NULL, OR_OPTIONS, FLAG,
>        "whether or not to fix miscapitalized/misspelled requests" },
> +    { "ShowSpellingAlternates", set_speling_alternates, NULL, OR_OPTIONS, FLAG,
> +      "whether to show lists of alternates for misspelled requested" },
>      { NULL }
>  };
>  
> @@ -440,7 +455,7 @@
>           * Otherwise, a "[300] Multiple Choices" list with the variants is
>           * returned.
>           */
> -        else {
> +        else if (cfg->alternates) {
>              ap_pool_t *p;
>              ap_table_t *notes;
>  	    ap_pool_t *sub_pool;
> 
> --vkogqOf2sHV7VnPd--
> 


-- 
===========================================================================
   Jim Jagielski   [|]   jim@jaguNET.com   [|]   http://www.jaguNET.com/
                "Are you suggesting coconuts migrate??"

Mime
View raw message