[mapserver-commits] r7438 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Fri Mar 7 20:48:07 EST 2008
Author: tomkralidis
Date: 2008-03-07 20:48:06 -0500 (Fri, 07 Mar 2008)
New Revision: 7438
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapogcsos.c
Log:
Support URI encoded procedures correctly (#2547)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2008-03-07 13:57:58 UTC (rev 7437)
+++ trunk/mapserver/HISTORY.TXT 2008-03-08 01:48:06 UTC (rev 7438)
@@ -13,6 +13,8 @@
Current Version (5.1-dev, SVN trunk):
-------------------------------------
+- mapogcsos.c: support URI encoded procedures correctly (#2547)
+
- Added support for EMPTY template with WMS GetFeatureInfo (#546)
- Throw an exception if the WCS request does not overlap layer (#2503)
Modified: trunk/mapserver/mapogcsos.c
===================================================================
--- trunk/mapserver/mapogcsos.c 2008-03-07 13:57:58 UTC (rev 7437)
+++ trunk/mapserver/mapogcsos.c 2008-03-08 01:48:06 UTC (rev 7438)
@@ -1796,7 +1796,7 @@
int nDiffrentProc = 0;
SOSProcedureNode *paDiffrentProc = NULL;
char *pszProcedureValue = NULL;
-
+
sBbox = map->extent;
psNsSos = xmlNewNs(NULL, BAD_CAST "http://www.opengis.net/sos/1.0", BAD_CAST "sos");
@@ -2428,8 +2428,10 @@
int iItemPosition = -1;
shapeObj sShape;
int status;
- char *tmpstr = NULL, *pszTmp = NULL;
+ char *tmpstr = NULL, *pszTmp = NULL, *pszProcedureURI = NULL, *pszProcedureId = NULL;
+ pszProcedureURI = strdup("urn:ogc:def:procedure:");
+
if (!sosparams->pszOutputFormat) {
msSetError(MS_SOSERR, "Missing mandatory parameter outputFormat.", "msSOSDescribeSensor()");
return msSOSException(map, "outputformat", "MissingParameterValue");
@@ -2455,10 +2457,14 @@
int bFound = 0;
tokens = msStringSplit(pszId, ' ', &n);
for (k=0; k<n; k++) {
- if (tokens[k] && strlen(tokens[k]) > 0 && strcasecmp(tokens[k], sosparams->pszProcedure) == 0) {
- bFound = 1;
- msFreeCharArray(tokens, n);
- break;
+ if (tokens[k] && strlen(tokens[k]) > 0) {
+ pszProcedureURI = msStringConcatenate(pszProcedureURI, tokens[k]);
+ if (strcasecmp(pszProcedureURI, sosparams->pszProcedure) == 0) {
+ bFound = 1;
+ pszProcedureId = strdup(tokens[k]);
+ msFreeCharArray(tokens, n);
+ break;
+ }
}
}
if (bFound) {
@@ -2471,7 +2477,7 @@
tmpstr = (char *)malloc(sizeof(char)*strlen("procedure") + 3);
sprintf(tmpstr,"%%%s%%", "procedure");
if (msCaseFindSubstring(pszUrl, tmpstr) != NULL)
- pszTmp = msCaseReplaceSubstring(pszTmp, tmpstr, sosparams->pszProcedure);
+ pszTmp = msCaseReplaceSubstring(pszTmp, tmpstr, pszProcedureId);
msFree(tmpstr);
pszEncodedUrl = msEncodeHTMLEntities(pszTmp);
@@ -2511,28 +2517,32 @@
if(status != MS_SUCCESS)
continue;
- if (sShape.values[iItemPosition] && strcasecmp(sShape.values[iItemPosition], sosparams->pszProcedure) == 0) {
- pszUrl = msOWSLookupMetadata(&(lp->metadata), "S", "describesensor_url");
- if (pszUrl) {
- pszTmp = strdup(pszUrl);
+ if (sShape.values[iItemPosition]) {
+ pszProcedureURI = msStringConcatenate(pszProcedureURI, sShape.values[iItemPosition]);
+ if (strcasecmp(pszProcedureURI, sosparams->pszProcedure) == 0) {
+ pszUrl = msOWSLookupMetadata(&(lp->metadata), "S", "describesensor_url");
+ pszProcedureId = strdup(sShape.values[iItemPosition]);
+ if (pszUrl) {
+ pszTmp = strdup(pszUrl);
- /* %procedure% is the hardcoded variable names to use
- within sos_describesensor_url */
- tmpstr = (char *)malloc(sizeof(char)*strlen("procedure") + 3);
- sprintf(tmpstr,"%%%s%%", "procedure");
- if (msCaseFindSubstring(pszUrl, tmpstr) != NULL)
- pszTmp = msCaseReplaceSubstring(pszTmp, tmpstr, sosparams->pszProcedure);
- msFree(tmpstr);
+ /* %procedure% is the hardcoded variable names to use
+ within sos_describesensor_url */
+ tmpstr = (char *)malloc(sizeof(char)*strlen("procedure") + 3);
+ sprintf(tmpstr,"%%%s%%", "procedure");
+ if (msCaseFindSubstring(pszUrl, tmpstr) != NULL)
+ pszTmp = msCaseReplaceSubstring(pszTmp, tmpstr, pszProcedureId);
+ msFree(tmpstr);
- pszEncodedUrl = msEncodeHTMLEntities(pszTmp);
- msIO_printf("Location: %s\n\n", pszEncodedUrl);
- msFree(pszTmp);
- return(MS_SUCCESS);
+ pszEncodedUrl = msEncodeHTMLEntities(pszTmp);
+ msIO_printf("Location: %s\n\n", pszEncodedUrl);
+ msFree(pszTmp);
+ return(MS_SUCCESS);
+ }
+ else {
+ msSetError(MS_SOSERR, "Missing mandatory metadata sos_describesensor_url on layer %s", "msSOSDescribeSensor()", lp->name);
+ return msSOSException(map, "sos_describesensor_url", "MissingValue");
+ }
}
- else {
- msSetError(MS_SOSERR, "Missing mandatory metadata sos_describesensor_url on layer %s", "msSOSDescribeSensor()", lp->name);
- return msSOSException(map, "sos_describesensor_url", "MissingValue");
- }
}
}
}
More information about the mapserver-commits
mailing list