You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Philip Gwyn <fi...@artware.qc.ca> on 1998/08/15 02:15:56 UTC

general/2859: mod_speling does not provide the list of alternatives to ErrorDocument CGIs

>Number:         2859
>Category:       general
>Synopsis:       mod_speling does not provide the list of alternatives to ErrorDocument CGIs
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          change-request
>Submitter-Id:   apache
>Arrival-Date:   Fri Aug 14 17:20:00 PDT 1998
>Last-Modified:
>Originator:     fil@artware.qc.ca
>Organization:
apache
>Release:        1.3.1
>Environment:
All, I guess.  I use Linux 2.0.35, GCC 2.7.2.1.  But it's not germaine
to this discussion.
	
>Description:
First, i'd like to say that mod_speling is the greatest of the new modules!
I love it!  I should be included and activated by default, imho.

I love it!  I should be included and activated by default, imho.

1- The HTML generated by mod_speling is less than beautiful.  I've improved it
a tad

2- The output is English-only.  I use ErrorDocument CGIs to generate (hopefully
useful messages about problems in French.  However, mod_speling has no
mechanism that tells the CGI what the available variants are.  This patch
places the variants in an enviroment var called VARIANT_LIST.  Format is
URL(space)reason\n  Example :
/foo.html miscapitalized
/Foo.txt common basename

Perl code to parse it:
%variant_list=map {split ' ', $_, 2} split /\n/, $ENV{VARIANT_LIST};

I realise using a space and \n as field seperators isn't the greatest of
ideas.  I can't think of other chars that are invalide in an URL.

	
>How-To-Repeat:
Head on over to http://www.artware.qc.ca/zoo/ote or
http://www.artware.qc.ca/zoo/Ote/foo to see the results.  Sorry, only French
is available. -:)
>Fix:
*** mod_speling.c.orig  Wed Jul  8 17:47:18 1998
--- mod_speling.c   Fri Aug 14 15:35:21 1998
***************
*** 360,366 ****
           * returned.
           */
          else {
!             char *t;
              pool *p;
              table *notes;

--- 360,366 ----
           * returned.
           */
          else {
!             char *t, *choices, *name;
              pool *p;
              table *notes;

***************
*** 382,398 ****
               * XXX: FIXME: Limit the list to a maximum number of entries
               */
              t = "";

              for (i = 0; i < candidates->nelts; ++i) {
!
                  /* The format isn't very neat... */
!                 t = ap_pstrcat(p, t, "<li><a href=\"", url,
!                  variant[i].name, r->path_info, "\">",
!                  variant[i].name, r->path_info,
!                  r->parsed_uri.query ? "?" : "",
!                  r->parsed_uri.query ? r->parsed_uri.query : "",
!                  "</a> (",
!                     sp_reason_str[(int) (variant[i].quality)], ")\n", NULL);

                  /*
                   * when we have printed the "close matches" and there are
--- 382,400 ----
               * XXX: FIXME: Limit the list to a maximum number of entries
               */
              t = "";
+             choices="";

              for (i = 0; i < candidates->nelts; ++i) {
!                 /* find the sub process name */
!                 name = ap_pstrcat(p, url, variant[i].name, r->path_info,
!                             (r->parsed_uri.query ? "?" : ""),
!                           (r->parsed_uri.query ? r->parsed_uri.query : ""),
!                               NULL);
                  /* The format isn't very neat... */
!                 t = ap_pstrcat(p, t, "<li><a href=\"", name, "\">",
!                         name, "</a> (",
!                         sp_reason_str[(int) (variant[i].quality)], ")\n",
!                         NULL);

                  /*
                   * when we have printed the "close matches" and there are
***************
*** 406,412 ****
--- 408,419 ----
                      && variant[i + 1].quality == SP_VERYDIFFERENT) {
                      t = ap_pstrcat(p, t, "</ul>\nFurthermore, the following r
                  }
+                 choices = ap_pstrcat(p, choices, name, " ",
+                                      sp_reason_str[(int) (variant[i].quality)
+                                      "\n", NULL);
              }
+             ap_table_setn(r->subprocess_env, "VARIANT_LIST", choices);
+
              t = ap_pstrcat(p, "The document name you requested (<code>",
                       r->uri, "</code>) could not be found on this server.\n"
                          "However, we found documents with names similar to th


>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, ]
[you need to include <ap...@Apache.Org> in the Cc line ]
[and leave the subject line UNCHANGED.  This is not done]
[automatically because of the potential for mail loops. ]
[If you do not include this Cc, your reply may be ig-   ]
[nored unless you are responding to an explicit request ]
[from a developer.                                      ]
[Reply only with text; DO NOT SEND ATTACHMENTS!         ]