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

thomas bonfort thomas.bonfort at gmail.com
Wed Oct 1 07:30:08 PDT 2014


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



More information about the MapServer-users mailing list