[mapserver-commits] r7391 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Mon Feb 18 12:01:19 EST 2008


Author: tomkralidis
Date: 2008-02-18 12:01:18 -0500 (Mon, 18 Feb 2008)
New Revision: 7391

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapogcsos.c
Log:
handle ACCEPTVERSIONS parameter (#2515)



Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2008-02-18 17:00:05 UTC (rev 7390)
+++ trunk/mapserver/HISTORY.TXT	2008-02-18 17:01:18 UTC (rev 7391)
@@ -13,6 +13,8 @@
 Current Version (5.1-dev, SVN trunk):
 -------------------------------------
 
+- mapogcsos.c: handle ACCEPTVERSIONS parameter (#2515)
+
 - mapwcs.c/mapwcs11.c: s/neighbour/neighbor/g (#2518)
 
 - mapwms.c: relax FORMAT parameter restrictions for GetFeatureInfo (#2517)

Modified: trunk/mapserver/mapogcsos.c
===================================================================
--- trunk/mapserver/mapogcsos.c	2008-02-18 17:00:05 UTC (rev 7390)
+++ trunk/mapserver/mapogcsos.c	2008-02-18 17:01:18 UTC (rev 7391)
@@ -1193,6 +1193,42 @@
 
     int ows_version = OWS_1_1_0;
 
+    int sosSupportedVersions[] = {OWS_1_0_0};
+    int sosNumSupportedVersions = 1;
+
+    // acceptversions: do OWS Common style of version negotiation
+    if (sosparams->pszAcceptVersions) {
+      char **tokens;
+      int i, j, k=-1;
+
+      tokens = msStringSplit(sosparams->pszAcceptVersions, ',', &j);
+
+      for (i=0; i<j;i++) {
+        int iVersion = 0;
+
+        iVersion = msOWSParseVersionString(tokens[i]);
+
+        if (iVersion == -1) {
+          msSetError(MS_SOSERR, "Invalid version format.", "msSOSGetCapabilities()", tokens[i]);
+          msFreeCharArray(tokens, j);
+          return msSOSException(map, "acceptversions", "VersionNegotiationFailed");
+        }
+
+        /* negotiate version */
+        k = msOWSCommonNegotiateVersion(iVersion, sosSupportedVersions, sosNumSupportedVersions);
+
+        if (k != -1)
+          break;
+      }
+      msFreeCharArray(tokens, j);
+
+      if(k == -1){
+          msSetError(MS_SOSERR, "ACCEPTVERSIONS list (%s) does not match supported versions (%s)", "msSOSGetCapabilities()", sosparams->pszAcceptVersions, pszSOSVersion);
+          return msSOSException(map, "acceptversions", "VersionNegotiationFailed");
+      }
+    }
+
+    // updateSequence
     updatesequence = msOWSLookupMetadata(&(map->web.metadata), "SO", "updatesequence");
 
     if (sosparams->pszUpdateSequence != NULL) {
@@ -2574,7 +2610,7 @@
         sosparams->pszService = strdup(request->ParamValues[i]);
       else if (strcasecmp(request->ParamNames[i], "VERSION") == 0)
         sosparams->pszVersion = strdup(request->ParamValues[i]);
-      else if (strcasecmp(request->ParamNames[i], "ACCEPT_VERSIONS") == 0)
+      else if (strcasecmp(request->ParamNames[i], "ACCEPTVERSIONS") == 0)
         sosparams->pszAcceptVersions = strdup(request->ParamValues[i]);
       else if (strcasecmp(request->ParamNames[i], "REQUEST") == 0)
         sosparams->pszRequest = strdup(request->ParamValues[i]);



More information about the mapserver-commits mailing list