Re: [mapserver-users] Mapserver CGI URL parameter parsing with plus character escaped as %2b
Thank you for the speedy response. Yes.. that was exactly the issue. By placing a literal space within the parameter within OpenLayers, the URL arrives at mapserver escaped as labelitem%20columnname and everything works. May I suggest somewhere in the Mapserver CGI documentation it might mention that the plus sign is used to encode a space.. particularly in the section on CGI "Changing map file parameters via a form or a URL", as I couldn't find any mention of this. Thanks again for your help. On Wed, 1 Oct 2014 16:30:08 +0200 thomas bonfort wrote: > 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 > 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@lists.osgeo.org > > http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Mapserver CGI URL parameter parsing with plus character escaped as %2b
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-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@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 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@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
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 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@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Mapserver CGI URL parameter parsing with plus character escaped as %2b
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@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users