[mapserver-commits] r7324 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Tue Jan 29 12:04:28 EST 2008


Author: tomkralidis
Date: 2008-01-29 12:04:28 -0500 (Tue, 29 Jan 2008)
New Revision: 7324

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapwcs.c
Log:
better section parameter handling for CITE (#2485)


Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2008-01-29 13:25:50 UTC (rev 7323)
+++ trunk/mapserver/HISTORY.TXT	2008-01-29 17:04:28 UTC (rev 7324)
@@ -13,6 +13,8 @@
 Current Version (5.1-dev, SVN trunk):
 -------------------------------------
 
+- mapwcs.c: better section parameter handling for CITE (#2485)
+
 - mapwfs.c: point to the correct schema for exceptions (#2480)
 
 - shp2img.c/shp2pdf.c: clean up usage text, check for invalid layers (#2066)

Modified: trunk/mapserver/mapwcs.c
===================================================================
--- trunk/mapserver/mapwcs.c	2008-01-29 13:25:50 UTC (rev 7323)
+++ trunk/mapserver/mapwcs.c	2008-01-29 17:04:28 UTC (rev 7324)
@@ -708,36 +708,56 @@
     if( strncmp(params->version,"1.1",3) == 0 )
         return msWCSGetCapabilities11( map, params, req );
 
-  /* msIO_printf("Content-type: application/vnd.ogc.se_xml%c%c",10,10); */
-  msIO_printf("Content-type: text/xml%c%c",10,10);
+  /* if a bum section param is passed, throw exception */
+  if (params->section &&
+      strcasecmp(params->section, "/WCS_Capabilities/Service") != 0 &&
+      strcasecmp(params->section, "/WCS_Capabilities/Capability") != 0 &&
+      strcasecmp(params->section, "/WCS_Capabilities/ContentMetadata") != 0 &&
+      strcasecmp(params->section, "/") != 0) {
+      msIO_printf("Content-type: application/vnd.ogc.se_xml%c%c",10,10);
+      msSetError( MS_WCSERR,
+        "Invalid SECTION parameter \"%s\"",
+        "msWCSGetCapabilities()", params->section);
+      return msWCSException(map, params->section, "InvalidParameterValue", "section");
+  }
 
-  /* print common capability elements  */
-  /* TODO: DocType? */
+  else {
+    msIO_printf("Content-type: text/xml%c%c",10,10);
   
-  msOWSPrintEncodeMetadata(stdout, &(map->web.metadata), NULL, "wcs_encoding", OWS_NOERR, "<?xml version='1.0' encoding=\"%s\" standalone=\"no\" ?>\n", "ISO-8859-1");
+    /* print common capability elements  */
+    /* TODO: DocType? */
+    
+    msOWSPrintEncodeMetadata(stdout, &(map->web.metadata), NULL, "wcs_encoding", OWS_NOERR, "<?xml version='1.0' encoding=\"%s\" standalone=\"no\" ?>\n", "ISO-8859-1");
+  
+    if(!params->section || (params->section && strcasecmp(params->section, "/")  == 0)) msIO_printf("<WCS_Capabilities\n"
+                                "   version=\"%s\" \n"
+                                "   updateSequence=\"0\" \n"
+                                "   xmlns=\"http://www.opengis.net/wcs\" \n" 
+                                "   xmlns:xlink=\"http://www.w3.org/1999/xlink\" \n" 
+                                "   xmlns:gml=\"http://www.opengis.net/gml\" \n" 
+                                "   xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" 
+                                "   xsi:schemaLocation=\"http://www.opengis.net/wcs %s/wcs/%s/wcsCapabilities.xsd\">\n", params->version, msOWSGetSchemasLocation(map), params->version); 
+           
+    /* print the various capability sections */
+    if(!params->section || strcasecmp(params->section, "/WCS_Capabilities/Service") == 0)
+      msWCSGetCapabilities_Service(map, params);
+  
+    if(!params->section || strcasecmp(params->section, "/WCS_Capabilities/Capability")  == 0)
+      msWCSGetCapabilities_Capability(map, params, req);
+  
+    if(!params->section || strcasecmp(params->section, "/WCS_Capabilities/ContentMetadata")  == 0)
+      msWCSGetCapabilities_ContentMetadata(map, params);
+  
+    if(params->section && strcasecmp(params->section, "/")  == 0) {
+      msWCSGetCapabilities_Service(map, params);
+      msWCSGetCapabilities_Capability(map, params, req);
+      msWCSGetCapabilities_ContentMetadata(map, params);
+    }
+  
+    /* done */
+    if(!params->section || (params->section && strcasecmp(params->section, "/")  == 0)) msIO_printf("</WCS_Capabilities>\n");
+  }
 
-  if(!params->section) msIO_printf("<WCS_Capabilities\n"
-                              "   version=\"%s\" \n"
-                              "   updateSequence=\"0\" \n"
-                              "   xmlns=\"http://www.opengis.net/wcs\" \n" 
-                              "   xmlns:xlink=\"http://www.w3.org/1999/xlink\" \n" 
-                              "   xmlns:gml=\"http://www.opengis.net/gml\" \n" 
-                              "   xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" 
-                              "   xsi:schemaLocation=\"http://www.opengis.net/wcs %s/wcs/%s/wcsCapabilities.xsd\">\n", params->version, msOWSGetSchemasLocation(map), params->version); 
-         
-  /* print the various capability sections */
-  if(!params->section || strcasecmp(params->section, "/WCS_Capabilities/Service") == 0)
-    msWCSGetCapabilities_Service(map, params);
-
-  if(!params->section || strcasecmp(params->section, "/WCS_Capabilities/Capability")  == 0)
-    msWCSGetCapabilities_Capability(map, params, req);
-
-  if(!params->section || strcasecmp(params->section, "/WCS_Capabilities/ContentMetadata")  == 0)
-    msWCSGetCapabilities_ContentMetadata(map, params);
-
-  /* done */
-  if(!params->section) msIO_printf("</WCS_Capabilities>\n");
-
   /* clean up */
   /* msWCSFreeParams(params); */
 



More information about the mapserver-commits mailing list