Changeset 741 for branches/PublicaMundi_David_integration_01-devel/zoo-project/zoo-kernel/request_parser.c
- Timestamp:
- Oct 7, 2015, 8:41:43 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PublicaMundi_David_integration_01-devel/zoo-project/zoo-kernel/request_parser.c
r654 r741 92 92 _("The maximum allowed occurrences for <%s> (%i) was exceeded."), 93 93 mi->name, atoi (testMap->value)); 94 errorException (m, emsg, "InternalError", NULL );94 errorException (m, emsg, "InternalError", NULL,NULL); 95 95 return -1; 96 96 } … … 113 113 ("ZOO-Kernel was unable to load your data for %s position %s."), 114 114 mi->name, tmpMap->value); 115 errorException (m, emsg, "InternalError", NULL );115 errorException (m, emsg, "InternalError", NULL,NULL); 116 116 return -1; 117 117 } … … 124 124 ("The maximum allowed occurrences for <%s> is one."), 125 125 mi->name); 126 errorException (m, emsg, "InternalError", NULL );126 errorException (m, emsg, "InternalError", NULL,NULL); 127 127 return -1; 128 128 } … … 213 213 free(cursor_input); 214 214 return errorException (*main_conf, _("Unable to allocate memory."), 215 "InternalError", NULL );215 "InternalError", NULL,NULL); 216 216 } 217 217 int i = 0; … … 224 224 free(cursor_input); 225 225 return errorException (*main_conf, _("Unable to allocate memory."), 226 "InternalError", NULL );226 "InternalError", NULL,NULL); 227 227 } 228 228 snprintf (inputs_as_text[i], strlen (pToken) + 1, "%s", pToken); … … 261 261 return errorException (*main_conf, 262 262 _("Unable to allocate memory."), 263 "InternalError", NULL );263 "InternalError", NULL,NULL); 264 264 } 265 265 tmpmaps->name = zStrdup (tmpn); … … 316 316 tmpv1 + 1); 317 317 free(cursor_input); 318 return errorException (*main_conf, emsg, "InternalError", NULL );318 return errorException (*main_conf, emsg, "InternalError", NULL,NULL); 319 319 } 320 320 addToMap (tmpmaps->content, tmpn1, tmpx2); 321 {322 321 if (loadRemoteFile 323 322 (&*main_conf, &tmpmaps->content, hInternet, tmpx2) < 0) 324 323 { 325 324 free(cursor_input); 326 return errorException (*main_conf, "Unable to fetch any ressource", "InternalError", NULL );325 return errorException (*main_conf, "Unable to fetch any ressource", "InternalError", NULL,NULL); 327 326 } 328 }327 329 328 free (tmpx2); 330 329 addIntToMap (tmpmaps->content, "Order", hInternet->nb); … … 350 349 { 351 350 free(cursor_input); 352 return errorException (*main_conf, "Unable to append maps", "InternalError", NULL );351 return errorException (*main_conf, "Unable to append maps", "InternalError", NULL,NULL); 353 352 } 354 353 } … … 402 401 free(cursor_output); 403 402 return errorException (*main_conf, _("Unable to allocate memory"), 404 "InternalError", NULL );403 "InternalError", NULL,NULL); 405 404 } 406 405 int i = 0; … … 413 412 free(cursor_output); 414 413 return errorException (*main_conf, _("Unable to allocate memory"), 415 "InternalError", NULL );414 "InternalError", NULL,NULL); 416 415 } 417 416 snprintf (outputs_as_text[i], strlen (pToken) + 1, "%s", … … 440 439 _ 441 440 ("Unable to allocate memory."), 442 "InternalError", NULL );441 "InternalError", NULL,NULL); 443 442 } 444 443 tmp_output->name = zStrdup (tmpc); … … 536 535 _ 537 536 ("Unable to allocate memory."), 538 "InternalError", NULL );537 "InternalError", NULL,NULL); 539 538 } 540 539 tmpmaps->name = zStrdup ((char *) val); … … 561 560 _ 562 561 ("Unable to allocate memory."), 563 "InternalError", NULL );562 "InternalError", NULL,NULL); 564 563 } 565 564 tmpmaps->name = zStrdup ("missingIndetifier"); … … 613 612 _("Unable to add a request in the queue."), 614 613 "InternalError", 615 NULL );614 NULL,NULL); 616 615 } 617 616 addIntToMap (tmpmaps->content, "Order", hInternet->nb); … … 665 664 ("Unable to allocate memory."), 666 665 "InternalError", 667 NULL );666 NULL,NULL); 668 667 } 669 668 snprintf (has, … … 675 674 xmlFree (val); 676 675 } 677 hInternet->ihandle[hInternet->nb].header = NULL; 678 hInternet->ihandle[hInternet->nb].header = 679 curl_slist_append (hInternet->ihandle 680 [hInternet->nb].header, 681 has); 682 if (has != NULL) 683 free (has); 676 if (has != NULL){ 677 hInternet->ihandle[hInternet->nb].header = NULL; 678 hInternet->ihandle[hInternet->nb].header = 679 curl_slist_append (hInternet->ihandle 680 [hInternet->nb].header, 681 has); 682 free (has); 683 } 684 684 } 685 685 else … … 781 781 ("Unable to allocate memory."), 782 782 "InternalError", 783 NULL );783 NULL,NULL); 784 784 } 785 785 size_t bRead; … … 951 951 xmlDocDumpFormatMemoryEnc (doc1, &mv, 952 952 &buffersize, 953 "utf-8", 1);953 "utf-8", 0); 954 954 char size[1024]; 955 955 sprintf (size, "%d", buffersize); … … 966 966 xmlDocDumpFormatMemoryEnc (doc1, &mv, 967 967 &buffersize, 968 "utf-8", 1); 969 char size[1024]; 970 sprintf (size, "%d", buffersize); 971 addToMap (tmpmaps->content, "size", 972 size); 973 xmlFreeDoc (doc2); 968 "utf-8", 0); 969 addIntToMap(tmpmaps->content, "size",buffersize); 970 xmlFreeDoc (doc2); 974 971 xmlFreeDoc (doc1); 975 972 } … … 1024 1021 _("Unable to append maps to maps."), 1025 1022 "InternalError", 1026 NULL );1023 NULL,NULL); 1027 1024 } 1028 1025 } … … 1113 1110 { 1114 1111 return errorException (*main_conf, _("Unable to allocate memory."), 1115 "InternalError", NULL );1112 "InternalError", NULL,NULL); 1116 1113 } 1117 1114 tmpmaps->name = zStrdup ("unknownIdentifier"); … … 1205 1202 _ 1206 1203 ("Unable to allocate memory."), 1207 "InternalError", NULL );1204 "InternalError", NULL,NULL); 1208 1205 } 1209 1206 tmpmaps->name = zStrdup ("unknownIdentifier"); … … 1292 1289 _ 1293 1290 ("Duplicate <Output> elements in WPS Execute request"), 1294 "InternalError", NULL );1291 "InternalError", NULL,NULL); 1295 1292 } 1296 1293 else { … … 1320 1317 * @return 0 on success, -1 on failure 1321 1318 */ 1322 int xmlParseRequest(maps** main_conf,const char* post,map** request_inputs,service* s,maps** inputs,maps** outputs,HINTERNET* hInternet ){1319 int xmlParseRequest(maps** main_conf,const char* post,map** request_inputs,service* s,maps** inputs,maps** outputs,HINTERNET* hInternet,struct cgi_env *cgi){ 1323 1320 1324 1321 map* version=getMapFromMaps(*main_conf,"main","rversion"); … … 1326 1323 1327 1324 xmlInitParser (); 1328 xmlDocPtr doc = xmlParseMemory (post, cgi ContentLength);1325 xmlDocPtr doc = xmlParseMemory (post, cgi->cgiContentLength); 1329 1326 1330 1327 /** … … 1428 1425 * @see kvpParseOutputs,kvpParseInputs,xmlParseRequest 1429 1426 */ 1430 int parseRequest(maps** main_conf,map** request_inputs,service* s,maps** inputs,maps** outputs,HINTERNET* hInternet ){1427 int parseRequest(maps** main_conf,map** request_inputs,service* s,maps** inputs,maps** outputs,HINTERNET* hInternet,struct cgi_env *cgi){ 1431 1428 map *postRequest = NULL; 1432 1429 postRequest = getMap (*request_inputs, "xrequest"); … … 1443 1440 { 1444 1441 //Parse XML request 1445 if(xmlParseRequest(main_conf,postRequest->value,request_inputs,s,inputs,outputs,hInternet )<0){1442 if(xmlParseRequest(main_conf,postRequest->value,request_inputs,s,inputs,outputs,hInternet,cgi)<0){ 1446 1443 return -1; 1447 1444 } … … 1465 1462 * @see runHttpRequests 1466 1463 */ 1467 int validateRequest(maps** main_conf,service* s,map* original_request, maps** request_inputs,maps** request_outputs,HINTERNET* hInternet){ 1468 1464 int validateRequest(maps** main_conf,service* s,map* original_request, maps** request_inputs,maps** request_outputs,HINTERNET* hInternet,struct cgi_env * cgi){ 1465 fprintf(stderr,"STEP 1 VALIDATE \n"); 1466 1469 1467 runHttpRequests (main_conf, request_inputs, hInternet); 1468 fprintf(stderr,"STEP 2 VALIDATE \n"); 1469 1470 1470 InternetCloseHandle (hInternet); 1471 1471 fprintf(stderr,"STEP 3 VALIDATE \n"); 1472 1472 1473 map* errI=NULL; 1473 1474 char *dfv = addDefaultValues (request_inputs, s->inputs, *main_conf, 0,&errI); … … 1491 1492 addToMap (tmpe, "locator", ptr->name); 1492 1493 addToMap (tmpe, "text", tmps); 1493 printExceptionReportResponse (*main_conf, tmpe );1494 printExceptionReportResponse (*main_conf, tmpe,NULL); 1494 1495 freeMap (&tmpe); 1495 1496 free (tmpe); … … 1499 1500 ptr = ptr->next; 1500 1501 } 1501 1502 fprintf(stderr,"STEP 4 VALIDATE \n"); 1503 dumpMaps(*request_outputs); 1502 1504 map* errO=NULL; 1503 1505 char *dfv1 = 1504 1506 addDefaultValues (request_outputs, s->outputs, *main_conf, 1,&errO); 1507 fprintf(stderr,"STEP 4 - 1 VALIDATE \n"); 1508 1505 1509 if (strcmp (dfv1, "") != 0 || strcmp (dfv, "") != 0) 1506 1510 { … … 1526 1530 } 1527 1531 } 1532 fprintf(stderr,"STEP 4 - 2 VALIDATE \n"); 1533 1528 1534 if (strcmp (dfv1, "") != 0) 1529 1535 { … … 1553 1559 } 1554 1560 } 1555 printExceptionReportResponse (*main_conf, tmpe); 1561 fprintf(stderr,"STEP 4 - 3 VALIDATE \n"); 1562 1563 printExceptionReportResponse (*main_conf, tmpe,NULL); 1556 1564 if(errI!=NULL){ 1557 1565 freeMap(&errI); … … 1567 1575 } 1568 1576 maps *tmpReqI = *request_inputs; 1577 fprintf(stderr,"STEP 5 VALIDATE \n"); 1578 1569 1579 while (tmpReqI != NULL) 1570 1580 { … … 1572 1582 if (getMap (tmpReqI->content, "isFile") != NULL) 1573 1583 { 1574 if (cgiFormFileName (tmpReqI->name, name, sizeof (name) ) ==1584 if (cgiFormFileName (tmpReqI->name, name, sizeof (name),&cgi) == 1575 1585 cgiFormSuccess) 1576 1586 { … … 1586 1596 int got, t; 1587 1597 map *path = getMapFromMaps (*main_conf, "main", "tmpPath"); 1588 cgiFormFileSize (tmpReqI->name, &size );1598 cgiFormFileSize (tmpReqI->name, &size,&cgi); 1589 1599 cgiFormFileContentType (tmpReqI->name, contentType, 1590 sizeof (contentType) );1591 if (cgiFormFileOpen (tmpReqI->name, &file ) == cgiFormSuccess)1600 sizeof (contentType),&cgi); 1601 if (cgiFormFileOpen (tmpReqI->name, &file,&cgi) == cgiFormSuccess) 1592 1602 { 1593 1603 t = -1; … … 1643 1653 tmpReqI = tmpReqI->next; 1644 1654 } 1645 1655 fprintf(stderr,"STEP FINAL VALIDATE \n"); 1656 1646 1657 ensureDecodedBase64 (request_inputs); 1647 1658 return 1;
Note: See TracChangeset
for help on using the changeset viewer.