Opened 13 years ago

Closed 13 years ago

#3973 closed enhancement (fixed)

MapScript: allow multiple CGI parameters with same key

Reported by: fschindler Owned by: fschindler
Priority: high Milestone:
Component: MapScript Version: unspecified
Severity: normal Keywords: MapScript CGI parameters
Cc: warmerdam, schpidi, tomkralidis, dmorissette, assefa, aboudreault

Description

Currently, MapScript CGI request objects are only able to add unique keys, all other calls to setParameter with the same key overwrite the previously inserted key-value pair.

The problem with that behavior is that it is inconsistent with standard CGI MapServer dispatches.

The following string, for example is perfectly legal with MapServer in CGI mode, but impossible to rebuild with MapScript:

http://someurl?service=WCS&version=2.0.0&request=GetCoverage&coverageid=id&size=x(100)&size=y(100)

This is a real world example, which makes it impossible for a MapScript application to be compliant to the current WCS 2.0 interface standard. In this specific situation the problem is circumvented in the msWCSParseRequest20 function by checking certain keys only to a certain character index. This allows constructs like size_x or resolution_y which are possible to insert with MapScript. But this is definitely not ideal.

My proposed solution is to add an additional MapScript function to allow a non-overwriting addition of a key-value pair to a CGI request object, for example named addParameter. This would allow to let the following Python code to function as expected:

ows_req = mapscript.OWSRequest()
ows_req.addParameter("service", "WCS")
ows_req.addParameter("version", "2.0.0")
ows_req.addParameter("request", "GetCoverage")
ows_req.addParameter("coverageid", "id")
ows_req.addParameter("size", "x(100)")
ows_req.addParameter("size", "y(100)")
map.OWSDispatch(ows_req)

Attachments (2)

r11972_cgirequestobj_addparam.patch (3.2 KB ) - added by fschindler 13 years ago.
Reference implementation for the depickted problem
r11973_mapscript_owsrequest_addparameter.patch (5.8 KB ) - added by fschindler 13 years ago.
Reworked patch for swig/php mapscript. Also contains updated documentation.

Download all attachments as: .zip

Change History (6)

by fschindler, 13 years ago

Reference implementation for the depickted problem

comment:1 by fschindler, 13 years ago

The patch http://trac.osgeo.org/mapserver/attachment/ticket/3973/r11972_cgirequestobj_addparam.patch implements the proposed function addParameter for both SWIG MapScript and PHP MapScript.

by fschindler, 13 years ago

Reworked patch for swig/php mapscript. Also contains updated documentation.

comment:2 by fschindler, 13 years ago

r11972_cgirequestobj_addparam.patch is now obsolete, r11973_mapscript_owsrequest_addparameter.patch includes all previous changes (plus a fix) and adds documentation

comment:3 by aboudreault, 13 years ago

Cc: aboudreault added

fschindler, I tested a php script and it works well.

comment:4 by schpidi, 13 years ago

Resolution: fixed
Status: newclosed

Thanks for testing.

Committed patch with r12507.

Note: See TracTickets for help on using tickets.