mapnik/OGCServer

Deleting 'service' and 'version' from request parameters

Opened this issue · 2 comments

In all request entry functions, notably 'call' in wsgi.py and modserver.py and 'process' in cgiserver.py, you delete 'service' and 'version' parameters from reqparams. However, in the exception handler you get the version from reqparams in order to determine whether to create a 1.1.1 or a 1.3.0 exception. Since 'version' has been deleted, you end up constantly returning 1.1.1 exceptions even if VERSION=1.3.0 was specified on the request.

Since I do not see any problems with having both 'service' and 'version' in reqparams around, I recommend NOT deleting these entries after the service handler was setup. If you agree, I will include this in one of my upcoming pull requests (likely in the XML-prettifying PR).

Hi Carsten,

the version is first passed to ServiceHandlerFactory, which will parse the version string. It looks servicehandler.processParameters function will not fail if version is present in reqparams.

Sure this can be simpler, so If you want to improve that code please use a different branch and PR. Of course code modification means adding tests, so maybe it is not worth it at this time, maybe in a bigger refactor.

        servicehandler = ServiceHandlerFactory(self.conf, self.mapfactory, onlineresource, reqparams.get('version', None))
        if reqparams.has_key('version'):
            del reqparams['version']
        if request not in servicehandler.SERVICE_PARAMS.keys():
            raise OGCException('Operation "%s" not supported.' % request, 'OperationNotSupported')
        ogcparams = servicehandler.processParameters(request, reqparams)

Hi Manel,

yes, as said previously, I will likely include a fix for NOT removing the 'version' (and, for the sake of consistency, for NOT removing the 'request') in one of my next PRs. I think it best fits into the PR for XML pretty-printing, XML namespace optimization etc. for both capabilities and service exception XML files coming up next.

Carsten