Received: (qmail 7791 invoked by uid 2012); 15 Aug 1998 00:15:56 -0000 Message-Id: <19980815001556.7787.qmail@hyperreal.org> Date: 15 Aug 1998 00:15:56 -0000 From: Philip Gwyn Reply-To: fil@artware.qc.ca To: apbugs@hyperreal.org Subject: mod_speling does not provide the list of alternatives to ErrorDocument CGIs X-Send-Pr-Version: 3.2 >Number: 2859 >Category: mod_speling >Synopsis: mod_speling does not provide the list of alternatives to ErrorDocument CGIs >Confidential: no >Severity: non-critical >Priority: medium >Responsible: apache >State: closed >Class: change-request >Submitter-Id: apache >Arrival-Date: Fri Aug 14 17:20:00 PDT 1998 >Last-Modified: Tue Sep 29 08:18:44 PDT 1998 >Originator: fil@artware.qc.ca >Organization: >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, "
  • path_info, "\">", ! variant[i].name, r->path_info, ! r->parsed_uri.query ? "?" : "", ! r->parsed_uri.query ? r->parsed_uri.query : "", ! " (", ! 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, "
  • ", ! name, " (", ! 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, "\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 (", r->uri, ") could not be found on this server.\n" "However, we found documents with names similar to th >Audit-Trail: Category-Changed-From-To: general-mod_speling Category-Changed-By: coar Category-Changed-When: Sun Sep 27 10:53:01 PDT 1998 State-Changed-From-To: open-closed State-Changed-By: coar State-Changed-When: Tue Sep 29 08:18:44 PDT 1998 State-Changed-Why: mod_speling has been modified to make the variant list available through the VARIANTS (or REDIRECT_VARIANTS) envariable. The format of the envariable is "uri";"reason", "uri";"reason", ... to properly contain the URI characters. Thanks for the report, and for using Apache! >Unformatted: [In order for any reply to be added to the PR database, ] [you need to include 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! ]