<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7226.0">
<TITLE>RE: [UMN_MAPSERVER-DEV] should Mapserver WMS client URL encode?</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>Paul -<BR>
<BR>
Thanks for the help!&nbsp; Actually, I didn't read the spec backwards.&nbsp; I just didn't realize that the original question was about commas in layer names!&nbsp; My comments about the spec aren't incorrect (I don't think) but I did definitely omit the references to the special characters that are not to be escaped.&nbsp; As you say, deciding that &quot;%2C&quot; and &quot;,&quot; have two fundamentally different meanings is bizarre and more than a little error-prone.<BR>
<BR>
All commas are equal, but some commas are more equal than others!<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp; - Ed<BR>
<BR>
<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: Paul Ramsey [<A HREF="mailto:pramsey@refractions.net">mailto:pramsey@refractions.net</A>]<BR>
Sent: Fri 3/25/2005 3:10 PM<BR>
To: Ed McNierney<BR>
Cc: MAPSERVER-DEV@LISTS.UMN.EDU<BR>
Subject: Re: [UMN_MAPSERVER-DEV] should Mapserver WMS client URL encode?<BR>
<BR>
<BR>
Ed, Bart,<BR>
<BR>
I think the specification is clear enough: there is a difference<BR>
between a &quot;,&quot; and %2C.&nbsp; This is particularly important for LAYERS, for<BR>
example:<BR>
<BR>
LAYERS=Roads%2C%20Rough,Roads%2C%20Paved<BR>
<BR>
If you decoded the LAYERS value *before* splitting on the &quot;,&quot; you would<BR>
end up with four layers. If you did it after, you would end up with<BR>
two, as is intended.<BR>
<BR>
The same twisted logic I assume applies to the BBOX parameter because<BR>
of the European use of &quot;,&quot; as the decimal place in floating point<BR>
numbers.<BR>
<BR>
So, basically, the behavior described in the specification is not<BR>
optional on either the client *or* the server side.&nbsp; If you treat it is<BR>
if it were, you will occasionally (but not very often) get degenerate<BR>
results in your WMS client/server interactions.<BR>
<BR>
BTW, Ed, you have read the paragraph you quoted exactly backwards: the<BR>
section requires that the special characters *not* be encoded when used<BR>
within the roles given in the table following.&nbsp; The roles for the ?,+,&amp;<BR>
and = are standard CGI roles, so are sort of (really) redundant to be<BR>
in the WMS spec. The role for &quot;,&quot; though, is quite particular to the<BR>
WMS spec (From the Table 1): Separator between individual values in<BR>
list-oriented parameters (such as BBOX, LAYERS and STYLES in the GetMap<BR>
request).<BR>
<BR>
So, to reiterate, you should never see a parameter that looks like this:<BR>
<BR>
&nbsp;&nbsp; BBOX=-180%2C-90%2C180%2C90%2C<BR>
<BR>
Because the specification says that in the role of separator for BBOX<BR>
(and LAYERS and STYLES) parameters the &quot;,&quot; is to be left unencoded (and<BR>
damn the RFC!)<BR>
<BR>
&nbsp;&nbsp; BBOX=-180,-90,180,90<BR>
<BR>
On the server side, this little quirk of the spec requires some extra<BR>
steps in processing the magic parameters.&nbsp; For LAYER, BBOX and STYLES,<BR>
first split on comma, then decode the individual elements, then<BR>
continue processing.&nbsp; For any parameter *except* LAYER, BBOX and<BR>
STYLES, ordinary CGI handling is sufficient.&nbsp; This of course will break<BR>
any client that currently uses naive URL encoding on *all* value<BR>
parameters.&nbsp; Support for broken (out of spec) clients requires an extra<BR>
two-step to first check if there are any literal commas in the value<BR>
parameter.<BR>
<BR>
Paul<BR>
<BR>
On 25-Mar-05, at 8:54 AM, Ed McNierney wrote:<BR>
<BR>
&gt; I don't recall the previous discussion, but it would seem strange for a<BR>
&gt; WMS server to NOT handle HTTP querystrings that were URL-encoded.&nbsp; The<BR>
&gt; specification doesn't QUITE come out and say that servers shall accept<BR>
&gt; all valid encoded querystrings, but it does say (Section 6.2.1, WMS<BR>
&gt; 1.1.1 spec):<BR>
&gt;<BR>
&gt; When the characters &quot;?&quot;, &quot;&amp;&quot;, &quot;=&quot;, &quot;/&quot;, &quot;:&quot; and &quot;,&quot; appear in one of<BR>
&gt; the<BR>
&gt; roles defined in Table 1, they are to appear literally in the URL. When<BR>
&gt; such characters appear elsewhere (for example, in the value of a<BR>
&gt; parameter), they are to be encoded as defined in [IETF RFC 2396].<BR>
&gt;<BR>
&gt; This section requires the client to encode at least these special<BR>
&gt; characters.&nbsp; It doesn't say that the SERVER shall accept them, but I<BR>
&gt; would expect that to be the intended result &lt;g&gt;.&nbsp; And if you're going<BR>
&gt; to<BR>
&gt; accept THOSE characters in RFC-2396 encodings, then it's reasonable to<BR>
&gt; expect that ALL valid RFC-2396 encodings should be accepted.<BR>
&gt;<BR>
&gt; The problem in the spec (as far as URL querystrings go) is that the<BR>
&gt; focus is on the rules clients must follow in constructing URL<BR>
&gt; querystrings, while there is nothing said about what rules servers must<BR>
&gt; follow.&nbsp; I would say there's a strong implication throughout Section<BR>
&gt; 6.2<BR>
&gt; that any valid URL querystring should be supported by a WMS server.<BR>
&gt;<BR>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Ed<BR>
&gt;<BR>
&gt; Ed McNierney<BR>
&gt; President and Chief Mapmaker<BR>
&gt; TopoZone.com / Maps a la carte, Inc.<BR>
&gt; 73 Princeton Street, Suite 305<BR>
&gt; North Chelmsford, MA&nbsp; 01863<BR>
&gt; ed@topozone.com<BR>
&gt; (978) 251-4242<BR>
&gt;<BR>
&gt; -----Original Message-----<BR>
&gt; From: UMN MapServer Developers List<BR>
&gt; [<A HREF="mailto:MAPSERVER-DEV@LISTS.UMN.EDU">mailto:MAPSERVER-DEV@LISTS.UMN.EDU</A>]<BR>
&gt; On Behalf Of Bart van den Eijnden<BR>
&gt; Sent: Friday, March 25, 2005 10:50 AM<BR>
&gt; To: MAPSERVER-DEV@LISTS.UMN.EDU<BR>
&gt; Subject: [UMN_MAPSERVER-DEV] should Mapserver WMS client URL encode?<BR>
&gt;<BR>
&gt; Hi list,<BR>
&gt;<BR>
&gt; I remember a discussion initiated by me about a year ago about whether<BR>
&gt; or not Mapserver CGI should react correctly to URL encoded requests.<BR>
&gt; The<BR>
&gt; answer was, if I remember correctly, that it does not have to do that.<BR>
&gt;<BR>
&gt; Together with Nuno, I have been looking into a problem letting<BR>
&gt; Mapserver<BR>
&gt; WMS client talk with the ERMapper WMS.<BR>
&gt;<BR>
&gt; ERMapper WMS does not like URL encoded parameters, but Mapserver WMS<BR>
&gt; client does encode a few, like layers and bbox.<BR>
&gt;<BR>
&gt; I would assume that given the outcome of the previous discussion,<BR>
&gt; Mapserver WMS client is wrong in encoding the parameters.<BR>
&gt;<BR>
&gt; Is this a right assumption?<BR>
&gt;<BR>
&gt; Best regards,<BR>
&gt; Bart<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>