Forum OpenACS Q&A: patch for html 4.0, use semicolons and not ampersands in uris

I have created a patch, for AOLserver at to support HTML4.0 specification Appendix B.2.2, regarding special characters in URL attribute values, specifically using a semicolon, ';', in a URI instead of an ampersand, '&'.

With this patch, AOLserver will take a URI that uses semicolons and not ampersands and correctly parse the URI into form variables and their values.

B.2.2 Ampersands in URI attribute values

The URI that is constructed when a form is submitted may be used as an anchor-style link (e.g., the href attribute for the A element). Unfortunately, the use of the "&" character to separate form fields interacts with its use in SGML attribute values to delimit character entity references. For example, to use the URI "http://host/?x=1&y=2" as a linking URI, it must be written <A href="http://host/?x=1&#38;y=2"> or <A href="http://host/?x=1&amp;y=2">.

We recommend that HTTP server implementors, and in particular, CGI implementors support the use of ";" in place of "&" to save authors the trouble of escaping "&" characters in this manner.

This patch adds a config.tcl parameter
    ns_section ns/server/yourserver
    ns_param semicolonqueryseparator yes

The default value is no, or not examining URI's for semicolons.

nsd/nsconf.c - read ns_param semicolonseparator for ns_querytoset
nsd/nsconf.h - define CONN_SEMICOLON_SEP_BOOL for ns_querytoset
nsd/nsd.h - added semicolonseparator to struct conn in struct _nsconf for ns_querytoset nsd/conn.c - NS_QueryToSet - modified to examine semicolons inside of a request