You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by "Brent A. Ellingson" <be...@sundog.net> on 2001/04/14 01:03:24 UTC

accepting semicolons in query strings in v 1.3.1

We've been converting a site using Apache::Registry and CGI.pm over to
Embperl v1.3.x, and we ran into a problem getting Embperl to accept some
query strings that CGI.pm would accept (and create).

It seems that w3c recommends that CGI libraries accept both semicolons
';' in addition to ampersands '&' as form field separators in
application/x-www-form-urlencoded query strings.  Quite a few places on
the site we construct URI's like /events?year=2001;month=6 instead of
/events?year=2001&month=6, and CGI.pm has accepted them. See:

 
http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2

However, CGI.pm will not only accept semicolons as form field
separators, but will also construct query strings with semicolons by
default.  This is probably incorrect behavior:
 
 
http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#form-content-type

But, it's the behavior of CGI.pm, and it could be argued that not
accepting the ';' is probably incorrect also.

Rfc2396 (the URI generic syntax) is silent on this issue -- it just says
in section 3.4: 

  > Within a query component, the characters ";", "/", "?", ":", "@",
"&", "=", "+", ",", and "$" are reserved.

So, the use of the ampersand vs. the semicolon as the form field
separator is akin to using the "+" as a space -- the rfc is silent on
the issue, saying only that the characters are reserved, and leaving
their meaning entirely up to whoever defines the MIME type
application/x-www-form-urlencoded.  

Anyhow, I'm just trying to work up to the justification for this patch,
which modifies the function "GetFormData" so that in addition to the
already correct behaviour of accepting "&" as a form field seperator, it
is made even more correct by accepting ";".

--- epmain.c.orig       Mon Feb 12 23:39:23 2001
+++ epmain.c    Fri Apr 13 17:19:37 2001
@@ -467,6 +467,7 @@
                 pQueryString++ ;
                 nLen-- ;
                 break ;
+            case ';':
             case '&':
                 pQueryString++ ;
                 nLen-- ;

-- 
Brent Ellingson
bellings@sundog.net

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: accepting semicolons in query strings in v 1.3.1

Posted by Gerald Richter <ri...@ecos.de>.
>
> Anyhow, I'm just trying to work up to the justification for this patch,
> which modifies the function "GetFormData" so that in addition to the
> already correct behaviour of accepting "&" as a form field seperator, it
> is made even more correct by accepting ";".
>

Ok, this makes sense to me. The patch will go into the next release of
Embperl.

Additionaly the ';' character will be escaped to %3B when outputed inside a
URL

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org