MCPcopy Index your code
hub / github.com/MapServer/MapServer / msWCSParseRequest

Function msWCSParseRequest

mapwcs.c:336–645  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

334/************************************************************************/
335
336static int msWCSParseRequest(cgiRequestObj *request, wcsParamsObj *params, mapObj *map)
337{
338 int i, n;
339 char **tokens;
340
341 if(!request || !params) /* nothing to do */
342 return MS_SUCCESS;
343
344/* -------------------------------------------------------------------- */
345/* Check if this appears to be an XML POST WCS request. */
346/* -------------------------------------------------------------------- */
347
348 msDebug("msWCSParseRequest(): request is %s.\n", (request->type == MS_POST_REQUEST)?"POST":"KVP");
349
350 if( request->type == MS_POST_REQUEST
351 && request->postrequest )
352 {
353#if defined(USE_LIBXML2)
354 xmlDocPtr doc = NULL;
355 xmlNodePtr root = NULL, child = NULL;
356 char *tmp = NULL;
357
358 /* parse to DOM-Structure and get root element */
359 if((doc = xmlParseMemory(request->postrequest, strlen(request->postrequest)))
360 == NULL) {
361 xmlErrorPtr error = xmlGetLastError();
362 msSetError(MS_WCSERR, "XML parsing error: %s",
363 "msWCSParseRequest()", error->message);
364 return MS_FAILURE;
365 }
366 root = xmlDocGetRootElement(doc);
367
368 /* Get service, version and request from root */
369 params->request = strdup((char *) root->name);
370 if ((tmp = (char *) xmlGetProp(root, BAD_CAST "service")) != NULL)
371 params->service = tmp;
372 if ((tmp = (char *) xmlGetProp(root, BAD_CAST "version")) != NULL)
373 params->version = tmp;
374
375 /* search first level children, either CoverageID, */
376 for (child = root->children; child != NULL; child = child->next)
377 {
378 if (EQUAL((char *)child->name, "AcceptVersions"))
379 {
380 /* will be overridden to 1.1.1 anyway */
381 }
382 else if (EQUAL((char *) child->name, "UpdateSequence"))
383 {
384 params->updatesequence = (char *)xmlNodeGetContent(child);
385 }
386 else if (EQUAL((char *) child->name, "Sections"))
387 {
388 xmlNodePtr sectionNode = NULL;
389 /* concatenate all sections by ',' */
390 for(sectionNode = child->children; sectionNode != NULL; sectionNode = sectionNode->next)
391 {
392 char *content;
393 if(!EQUAL((char *)sectionNode->name, "Section"))

Callers 1

msWCSDispatchFunction · 0.85

Calls 10

msDebugFunction · 0.85
msSetErrorFunction · 0.85
strdupFunction · 0.85
msStringConcatenateFunction · 0.85
strncasecmpFunction · 0.85
msStringSplitFunction · 0.85
msWCSExceptionFunction · 0.85
msFreeCharArrayFunction · 0.85
strcasecmpFunction · 0.85
msStrdupFunction · 0.85

Tested by

no test coverage detected