coar 98/09/29 08:13:19
Modified: src/modules/standard mod_speling.c
Log:
Make the list of spelling-correction variants available to
ErrorDocument 300 processing through the use of the new
envariable *VARIANTS. The format of the envariable value is
"uri";"reason", "uri";"reason", ... to be at least semi-consistent
with existing multi-value field usages. It's a little expensive
in terms of memory, but the number of variants should be small
and we're about to complete the request, so it seems a reasonable
tradeoff.
PR: 2859
Revision Changes Path
1.29 +13 -10 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.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- mod_speling.c 1998/09/25 17:17:54 1.28
+++ mod_speling.c 1998/09/29 15:13:18 1.29
@@ -453,18 +453,21 @@
t = "";
for (i = 0; i < candidates->nelts; ++i) {
+ char *vuri;
+ const char *reason;
+ reason = sp_reason_str[(int) (variant[i].quality)];
/* The format isn't very neat... */
- t = ap_pstrcat(p, t, "<li><a href=\"", url,
- variant[i].name, r->path_info,
- r->parsed_uri.query ? "?" : "",
- r->parsed_uri.query ? r->parsed_uri.query : "",
- "\">", 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);
+ vuri = ap_pstrcat(p, url, variant[i].name, r->path_info,
+ (r->parsed_uri.query != NULL) ? "?" : "",
+ (r->parsed_uri.query != NULL)
+ ? r->parsed_uri.query : "",
+ NULL);
+ ap_table_mergen(r->subprocess_env, "VARIANTS",
+ ap_pstrcat(p, "\"", vuri, "\";\"",
+ reason, "\"", NULL));
+ t = ap_pstrcat(p, t, "<li><a href=\"", vuri,
+ "\">", vuri, "</a> (", reason, ")\n", NULL);
/*
* when we have printed the "close matches" and there are