[mapserver-users] Mapserver CGI URL parameter parsing with plus character escaped as %2b

Basques, Bob (CI-StPaul) bob.basques at ci.stpaul.mn.us
Wed Oct 1 07:48:22 PDT 2014


All,

I ran into something similar recently, You should be able to leave the space in the URL or if you prefer you can encode as a space (instead of a + sign) and Mapserver should accept that (or at least I would expect it to . . .  :c).  the encoding/decoding should be handled by the webserver, then passed on to MapServer.

Bobb


-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of thomas bonfort
Sent: Wednesday, October 01, 2014 9:30 AM
To: Fergus McDonald
Cc: MapserverList OSGEO
Subject: Re: [mapserver-users] Mapserver CGI URL parameter parsing with plus character escaped as %2b

the + sign is used to encode a space in a url, and that space is what mapserver's parser is looking for. translated to mapfile syntax, your first two requests are parsed as

labelitem columnname

whereas the last one is

labelitem+columnname

which is invalid.

tl;dr don't escape the + sign, mapserver is expecting a space not a +

--
thomas

On 1 October 2014 16:15, Fergus McDonald <mapserver at schartz.net> wrote:
> I am having an issue with Mapserver 6.4.1 when attempting to pass a 
> layer labelitem parameter setting via URL.
>
> The map file contains the following validation for layer 0
>
> VALIDATION
>         "labelitem" "[a-z]+"
> END
>
> The following request works (ignore the double quotes around the 
> entire
> URL):
>
> "http://sitename/cgi-bin/map=pathtomapfile&mode=map&map.layer[0]=labelitem+columnname"
>
> as does this (note the brackets replaced with html escapes)
>
> "http://sitename/cgi-bin/map=pathtomapfile&mode=map&map.layer%5B0%5D=labelitem+columnname"
>
> ..but if the plus sign is escaped also:
>
> "http://sitename/cgi-bin/map=pathtomapfile&mode=map&map.layer%5B0%5D=labelitem%2Bcolumnname"
>
> Mapserver fails with the following error:
>
> getString(): Symbol definition error. Parsing error near (+):(line 1)
>
> This problem arises because when generating such requests from 
> OpenLayers, any such parameters automatically have the plus sign 
> escaped before the request is sent. It does seem unconsistent that 
> escapes are recognised for some parts of the URL and not others.
>
> Am I doing something wrong or should this be a bug report?
>
> Thanks in advance
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the mapserver-users mailing list