- Timestamp:
- Oct 7, 2015, 8:41:43 AM (9 years ago)
- Location:
- branches/PublicaMundi_David_integration_01-devel/zoo-project/zoo-kernel
- Files:
-
- 5 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PublicaMundi_David_integration_01-devel/zoo-project/zoo-kernel/Makefile.in
r677 r741 38 38 zoo_zcfg.o: zoo_zcfg.c service.h 39 39 g++ ${GLIB_CPPFLAGS} ${XML2CFLAGS} -c zoo_zcfg.c 40 41 logger.o: logger.c 42 gcc -c logger.c 43 44 zoo_json.o: zoo_json.c service.h 45 g++ ${JSON_CPPFLAGS} ${XML2CFLAGS} -c zoo_json.c 46 47 zoo_amqp.o: zoo_amqp.c 48 g++ ${CFLAGS} -c zoo_amqp.c 40 49 41 50 request_parser.o: request_parser.c request_parser.h … … 94 103 95 104 zoo_service_loader.o: zoo_service_loader.c service.h 96 g++ -g -O2 ${XML2CFLAGS} ${CFLAGS} ${SAGA_CFLAGS} ${OTBCFLAGS} ${PYTHONCFLAGS} ${JAVACFLAGS} ${JSCFLAGS} ${PERLCFLAGS} ${PHPCFLAGS} ${ SAGA_ENABLED} ${OTB_ENABLED} ${PYTHON_ENABLED} ${JS_ENABLED} ${PHP_ENABLED} ${PERL_ENABLED} ${JAVA_ENABLED}-c zoo_service_loader.c -fno-common -DPIC -o zoo_service_loader.o105 g++ -g -O2 ${XML2CFLAGS} ${CFLAGS} ${SAGA_CFLAGS} ${OTBCFLAGS} ${PYTHONCFLAGS} ${JAVACFLAGS} ${JSCFLAGS} ${PERLCFLAGS} ${PHPCFLAGS} ${JSON_CPPFLAGS} ${SAGA_ENABLED} ${OTB_ENABLED} ${PYTHON_ENABLED} ${JS_ENABLED} ${PHP_ENABLED} ${PERL_ENABLED} ${JAVA_ENABLED} -c zoo_service_loader.c -fno-common -DPIC -o zoo_service_loader.o 97 106 98 107 libzoo_service.${EXT}: version.h service_internal.o service.o sqlapi.o 99 108 gcc -shared ${GDAL_CFLAGS} ${DEFAULT_OPTS} -fpic -o libzoo_service.${EXT} ${CFLAGS} service_internal.o service.o sqlapi.o -lfcgi ${GDAL_LIBS} 100 109 101 zoo_loader.cgi: version.h libzoo_service.${EXT} zoo_loader.c zoo_service_loader.o ulinet.o zoo_zcfg.o service.h lex.sr.o service_conf.tab.o service_conf.y ulinet.o main_conf_read.tab.o lex.cr.o request_parser.o response_print.o server_internal.o caching.o ${MS_FILE} ${PYTHON_FILE} ${PHP_FILE} ${JAVA_FILE} ${JS_FILE} ${PERL_FILE} ${RUBY_FILE} ${YAML_FILE} ${OTB_FILE} ${SAGA_FILE} 102 g++ -g -O2 ${JSCFLAGS} ${PHPCFLAGS} ${PERLCFLAGS} ${RUBYCFLAGS} ${JAVACFLAGS} ${XML2CFLAGS} ${PYTHONCFLAGS} ${CFLAGS} -c zoo_loader.c -fno-common -DPIC -o zoo_loader.o 103 g++ ${JSCFLAGS} ${SAGA_CFLAGS} ${OTBCFLAGS} ${GDAL_CFLAGS} ${XML2CFLAGS} ${PHPCFLAGS} ${PERLCFLAGS} ${JAVACFLAGS} ${PYTHONCFLAGS} ${CFLAGS} zoo_loader.o zoo_service_loader.o ${MS_FILE} ${PYTHON_FILE} ${PERL_FILE} ${PHP_FILE} ${JS_FILE} ${JAVA_FILE} ${YAML_FILE} ${OTB_FILE} ${SAGA_FILE} response_print.o server_internal.o caching.o request_parser.o ulinet.o zoo_zcfg.o lex.cr.o lex.sr.o service_conf.tab.o main_conf_read.tab.o -o zoo_loader.cgi -L. ${LDFLAGS} 110 zoo_loader.cgi: version.h libzoo_service.${EXT} zoo_json.o zoo_amqp.o zoo_loader.c zoo_service_loader.o ulinet.o zoo_zcfg.o service.h lex.sr.o service_conf.tab.o service_conf.y ulinet.o main_conf_read.tab.o lex.cr.o request_parser.o response_print.o server_internal.o caching.o ${MS_FILE} ${PYTHON_FILE} ${PHP_FILE} ${JAVA_FILE} ${JS_FILE} ${PERL_FILE} ${RUBY_FILE} ${RABBITMQ_FILE} ${YAML_FILE} ${OTB_FILE} ${SAGA_FILE} 111 g++ -g -O2 ${JSCFLAGS} ${PHPCFLAGS} ${PERLCFLAGS} ${RUBYCFLAGS} ${JAVACFLAGS} ${XML2CFLAGS} ${PYTHONCFLAGS} ${JSON_CPPFLAGS} ${CFLAGS} -c zoo_loader.c -fno-common -DPIC -o zoo_loader.o 112 g++ ${JSCFLAGS} ${SAGA_CFLAGS} ${OTBCFLAGS} ${GDAL_CFLAGS} ${XML2CFLAGS} ${PHPCFLAGS} ${PERLCFLAGS} ${JAVACFLAGS} ${PYTHONCFLAGS} ${CFLAGS} zoo_loader.o zoo_service_loader.o ${RABBITMQ_FILE} ${MS_FILE} ${PYTHON_FILE} ${PERL_FILE} ${PHP_FILE} ${JS_FILE} ${JAVA_FILE} ${YAML_FILE} ${OTB_FILE} ${SAGA_FILE} response_print.o server_internal.o caching.o request_parser.o ulinet.o zoo_json.o zoo_zcfg.o lex.cr.o lex.sr.o service_conf.tab.o main_conf_read.tab.o -o zoo_loader.cgi -L. ${LDFLAGS} 113 114 zoo_fpm: version.h libzoo_service.${EXT} logger.o zoo_json.o zoo_amqp.o zoo_fpm.c zoo_service_loader.o ulinet.o zoo_zcfg.o service.h lex.sr.o service_conf.tab.o service_conf.y ulinet.o main_conf_read.tab.o lex.cr.o request_parser.o response_print.o server_internal.o caching.o ${MS_FILE} ${PYTHON_FILE} ${PHP_FILE} ${JAVA_FILE} ${JS_FILE} ${PERL_FILE} ${RUBY_FILE} ${RABBITMQ_FILE} ${YAML_FILE} ${OTB_FILE} ${SAGA_FILE} 115 g++ -g -O2 ${JSCFLAGS} ${PHPCFLAGS} ${PERLCFLAGS} ${RUBYCFLAGS} ${JAVACFLAGS} ${XML2CFLAGS} ${PYTHONCFLAGS} ${JSON_CPPFLAGS} ${CFLAGS} -c zoo_fpm.c -fno-common -DPIC -o zoo_fpm.o 116 g++ ${JSCFLAGS} ${SAGA_CFLAGS} ${OTBCFLAGS} ${GDAL_CFLAGS} ${XML2CFLAGS} ${PHPCFLAGS} ${PERLCFLAGS} ${JAVACFLAGS} ${PYTHONCFLAGS} ${CFLAGS} logger.o zoo_fpm.o zoo_service_loader.o ${RABBITMQ_FILE} ${MS_FILE} ${PYTHON_FILE} ${PERL_FILE} ${PHP_FILE} ${JS_FILE} ${JAVA_FILE} ${YAML_FILE} ${OTB_FILE} ${SAGA_FILE} response_print.o server_internal.o caching.o request_parser.o ulinet.o zoo_json.o zoo_zcfg.o lex.cr.o lex.sr.o service_conf.tab.o main_conf_read.tab.o -o zoo_fpm -L. ${LDFLAGS} 117 104 118 105 119 zcfg2yaml: zcfg2yaml.c service.h lex.sr.o service_conf.tab.o service_conf.y main_conf_read.tab.o lex.cr.o response_print.o server_internal.o service_internal.o ${MS_FILE} ${YAML_FILE} -
branches/PublicaMundi_David_integration_01-devel/zoo-project/zoo-kernel/ZOOMakefile.opts.in
r677 r741 55 55 RUBY_FILE=@RUBY_FILE@ 56 56 57 JSON_LDFLAGS=@JSON_LDFLAGS@ 58 JSON_CPPFLAGS=@JSON_CPPFLAGS@ 59 60 RABBITMQ_LDFLAGS=@RABBITMQ_LDFLAGS@ 61 RABBITMQ_CPPFLAGS=@RABBITMQ_CPPFLAGS@ 62 RABBITMQ_FILE=@RABBITMQ_FILE@ 63 57 64 JS_ENABLED=@JS_ENABLED@ 58 65 JSCFLAGS=@JS_CPPFLAGS@ … … 96 103 SAGA_FILE=@SAGA_FILE@ 97 104 98 CFLAGS= @RELY_ON_DB@ @DEB_DEF@ -fpic ${GLIB_CPPFLAGS} ${YAML_CFLAGS} ${MACOS_CFLAGS} ${MS_CFLAGS} -I../../thirds/cgic206 -I. -DLINUX_FREE_ISSUE #-DDEBUG #-DDEBUG_SERVICE_CONF99 LDFLAGS=-lzoo_service @DEFAULT_LIBS@ -L../../thirds/cgic206 -lcgic ${GDAL_LIBS} ${XML2LDFLAGS} ${GLIB_LDFLAGS} ${PYTHONLDFLAGS} ${PERLLDFLAGS} ${PHPLDFLAGS} ${JAVALDFLAGS} ${JSLDFLAGS} -lfcgi -lcrypto -luuid ${MS_LDFLAGS} ${MACOS_LD_FLAGS} ${MACOS_LD_NET_FLAGS} ${YAML_LDFLAGS} ${OTBLDFLAGS} ${SAGA_LDFLAGS}105 CFLAGS= @RELY_ON_DB@ @DEB_DEF@ -fpic ${GLIB_CPPFLAGS} ${YAML_CFLAGS} ${GDAL_CFLAGS} ${MACOS_CFLAGS} ${MS_CFLAGS} ${RABBITMQ_CPPFLAGS} -I../../thirds/cgic206 -I. -DLINUX_FREE_ISSUE #-DDEBUG #-DDEBUG_SERVICE_CONF 106 LDFLAGS=-lzoo_service @DEFAULT_LIBS@ -L../../thirds/cgic206 -lcgic ${GDAL_LIBS} ${XML2LDFLAGS} ${GLIB_LDFLAGS} ${PYTHONLDFLAGS} ${PERLLDFLAGS} ${JSON_LDFLAGS} ${RABBITMQ_LDFLAGS} ${PHPLDFLAGS} ${JAVALDFLAGS} ${JSLDFLAGS} -lfcgi -lcrypto -luuid ${MS_LDFLAGS} ${MACOS_LD_FLAGS} ${MACOS_LD_NET_FLAGS} ${YAML_LDFLAGS} ${OTBLDFLAGS} ${SAGA_LDFLAGS} 100 107 -
branches/PublicaMundi_David_integration_01-devel/zoo-project/zoo-kernel/caching.c
r642 r741 215 215 fcontent=(char*)malloc((hInternet->ihandle[index].nDataLen+1)*sizeof(char)); 216 216 if(fcontent == NULL){ 217 return errorException(*m, _("Unable to allocate memory."), "InternalError",NULL );217 return errorException(*m, _("Unable to allocate memory."), "InternalError",NULL,NULL); 218 218 } 219 219 size_t dwRead; … … 233 233 tmpMap->value=(char*)malloc((fsize+1)*sizeof(char)); 234 234 if(tmpMap->value==NULL){ 235 return errorException(*m, _("Unable to allocate memory."), "InternalError",NULL );235 return errorException(*m, _("Unable to allocate memory."), "InternalError",NULL,NULL); 236 236 } 237 237 memcpy(tmpMap->value,fcontent,(fsize+1)*sizeof(char)); … … 277 277 void addRequestToQueue(maps** m,HINTERNET* hInternet,const char* url,bool req){ 278 278 hInternet->waitingRequests[hInternet->nb]=strdup(url); 279 hInternet->ihandle[hInternet->nb].header=NULL;279 //hInternet->ihandle[hInternet->nb].header=NULL; 280 280 if(req) 281 281 InternetOpenUrl(hInternet,hInternet->waitingRequests[hInternet->nb],NULL,0,INTERNET_FLAG_NO_CACHE_WRITE,0); … … 304 304 */ 305 305 int loadRemoteFile(maps** m,map** content,HINTERNET* hInternet,char *url){ 306 char* fcontent ;306 char* fcontent = NULL; 307 307 char* cached=isInCache(*m,url); 308 308 char *mimeType=NULL; … … 338 338 } 339 339 340 }else{ 340 }else{ 341 341 addRequestToQueue(m,hInternet,url,true); 342 342 return 0; 343 343 } 344 344 if(fsize==0){ 345 return errorException(*m, _("Unable to download the file."), "InternalError",NULL );345 return errorException(*m, _("Unable to download the file."), "InternalError",NULL,NULL); 346 346 } 347 347 if(mimeType!=NULL){ … … 354 354 355 355 tmpMap->value=(char*)malloc((fsize+1)*sizeof(char)); 356 if(tmpMap->value==NULL) 357 return errorException(*m, _("Unable to allocate memory."), "InternalError",NULL); 356 357 if(tmpMap->value==NULL || fcontent == NULL) 358 return errorException(*m, _("Unable to allocate memory"), "InternalError",NULL,NULL); 358 359 memcpy(tmpMap->value,fcontent,(fsize+1)*sizeof(char)); 360 361 362 363 364 //if(tmpMap->value==NULL) 365 //return errorException(*m, _("Unable to allocate memory."), "InternalError",NULL,NULL); 366 //memcpy(tmpMap->value,fcontent,(fsize+1)*sizeof(char)); 359 367 360 368 char ltmp1[256]; -
branches/PublicaMundi_David_integration_01-devel/zoo-project/zoo-kernel/configure.ac
r677 r741 58 58 AC_SUBST([RELY_ON_DB]) 59 59 60 61 AC_ARG_WITH([rabbitmq], 62 [AS_HELP_STRING([--with-rabbittmq], [asynchronous requests management with rabbitmq ])], 63 [AMQP="-DAMQP"], [AMQP=""]) 64 65 if test -z "$AMQP" 66 then 67 RABBITMQ_LDFLAGS="" 68 RABBITMQ_CPPFLAGS="" 69 RABBITMQ_FILE="" 70 else 71 AC_CHECK_LIB([rabbitmq], [main]) 72 RABBITMQ_LDFLAGS=`pkg-config --libs librabbitmq` 73 RABBITMQ_CPPFLAGS="-DAMQP" `pkg-config --cflags librabbitmq` 74 RABBITMQ_FILE="zoo_amqp.o" 75 RELY_ON_DB="-DRELY_ON_DB" 76 AC_SUBST([RELY_ON_DB]) 77 fi 78 AC_SUBST([RABBITMQ_LDFLAGS]) 79 AC_SUBST([RABBITMQ_CPPFLAGS]) 80 AC_SUBST([RABBITMQ_FILE]) 60 81 61 82 # =========================================================================== … … 418 439 LIBS_SAVE="$LIBS" 419 440 LIBS="$PYTHON_LDFLAGS" 420 PY_LIB=`$PYTHONCONFIG --libs | sed -e 's/^.*\(python2\..\)$/\1/'` 421 AC_CHECK_LIB([$PY_LIB], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], []) 441 #PY_LIB=`$PYTHONCONFIG --libs | sed -e 's/^.*\(python2\..\)$/\1/'` 442 #PY_LIB=`$PYTHONCONFIG --libs` 443 #AC_CHECK_LIB([$PY_LIB], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], []) 422 444 AC_SUBST([PYTHON_CPPFLAGS]) 423 445 AC_SUBST([PYTHON_LDFLAGS]) … … 598 620 AC_SUBST([JAVA_FILE]) 599 621 622 623 # =========================================================================== 624 # Detect if json-c is available 625 # =========================================================================== 626 627 AC_CHECK_LIB([json-c], [main]) 628 JSON_LDFLAGS=`pkg-config --libs json-c` 629 JSON_CPPFLAGS=`pkg-config --cflags json-c` 630 631 AC_SUBST([JSON_LDFLAGS]) 632 AC_SUBST([JSON_CPPFLAGS]) 633 634 600 635 # =========================================================================== 601 636 # Detect if ruby is installed -
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; -
branches/PublicaMundi_David_integration_01-devel/zoo-project/zoo-kernel/request_parser.h
r677 r741 44 44 int xmlParseInputs(maps**,service*,maps**,xmlDocPtr,xmlNodeSet*,HINTERNET*); 45 45 int xmlParseOutputs(maps**,map**,maps**,xmlDocPtr,xmlNodePtr,bool); 46 int xmlParseRequest(maps**,const char*,map**,service*,maps**,maps**,HINTERNET* );47 int parseRequest(maps**,map**,service*,maps**,maps**,HINTERNET* );46 int xmlParseRequest(maps**,const char*,map**,service*,maps**,maps**,HINTERNET*,struct cgi_env *); 47 int parseRequest(maps**,map**,service*,maps**,maps**,HINTERNET*,struct cgi_env *); 48 48 void checkValidValue(map*,map**,const char*,const char**,int); 49 int validateRequest(maps**,service*,map*,maps**,maps**,HINTERNET* );49 int validateRequest(maps**,service*,map*,maps**,maps**,HINTERNET*,struct cgi_env *); 50 50 51 51 #ifdef __cplusplus -
branches/PublicaMundi_David_integration_01-devel/zoo-project/zoo-kernel/response_print.c
r677 r741 93 93 * @param m the map containing the headers informations 94 94 */ 95 void printHeaders(maps* m ){95 void printHeaders(maps* m,FCGX_Stream *out){ 96 96 maps *_tmp=getMaps(m,"headers"); 97 97 if(_tmp!=NULL){ 98 98 map* _tmp1=_tmp->content; 99 99 while(_tmp1!=NULL){ 100 printf("%s: %s\r\n",_tmp1->name,_tmp1->value);100 FCGX_FPrintF(out,"%s: %s\r\n", _tmp1->name, _tmp1->value); 101 101 _tmp1=_tmp1->next; 102 102 } … … 1445 1445 * @param outputs the outputs generated by the service 1446 1446 */ 1447 void printProcessResponse(maps* m,map* request, int pid,service* serv,const char* service,int status,maps* inputs,maps* outputs ){1447 void printProcessResponse(maps* m,map* request, int pid,service* serv,const char* service,int status,maps* inputs,maps* outputs,FCGX_Stream * out){ 1448 1448 xmlNsPtr ns,ns_ows,ns_xlink; 1449 1449 xmlNodePtr nr,n,nc,nc1=NULL,nc3; … … 1540 1540 hasStoredExecuteResponse=true; 1541 1541 } 1542 1543 1542 nc = xmlNewNode(ns, BAD_CAST "Process"); 1544 1543 map* tmp2=getMap(serv->content,"processVersion"); … … 1548 1547 map* tmpI=getMapFromMaps(m,"lenv","oIdentifier"); 1549 1548 printDescription(nc,ns_ows,tmpI->value,serv->content,0); 1550 1551 1549 xmlAddChild(n,nc); 1552 1550 … … 1695 1693 if(lid<0){ 1696 1694 /* If the lock failed */ 1697 errorException(m,_("Lock failed."),"InternalError",NULL );1695 errorException(m,_("Lock failed."),"InternalError",NULL,out); 1698 1696 xmlFreeDoc(doc); 1699 1697 xmlCleanupParser(); … … 1710 1708 sprintf(tmpMsg,_("Unable to create the file \"%s\" for storing the ExecuteResponse."),stored_path); 1711 1709 1712 errorException(m,tmpMsg,"InternalError",NULL );1710 errorException(m,tmpMsg,"InternalError",NULL,out); 1713 1711 xmlFreeDoc(doc); 1714 1712 xmlCleanupParser(); … … 1738 1736 #endif 1739 1737 } 1740 printDocument(m,doc,pid );1738 printDocument(m,doc,pid,out); 1741 1739 1742 1740 xmlCleanupParser(); … … 1751 1749 * @param pid the process identifier linked to a service 1752 1750 */ 1753 void printDocument(maps* m, xmlDocPtr doc,int pid ){1751 void printDocument(maps* m, xmlDocPtr doc,int pid,FCGX_Stream * out){ 1754 1752 char *encoding=getEncoding(m); 1755 1753 if(pid==getpid()){ 1756 printHeaders(m); 1757 printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding); 1758 } 1759 fflush(stdout); 1754 printHeaders(m,out); 1755 FCGX_FPrintF(out,"Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding); 1756 } 1760 1757 xmlChar *xmlbuff; 1761 1758 int buffersize; … … 1765 1762 */ 1766 1763 xmlDocDumpFormatMemoryEnc(doc, &xmlbuff, &buffersize, encoding, 1); 1767 printf("%s",xmlbuff); 1768 fflush(stdout); 1764 if (out != NULL){ 1765 FCGX_FPrintF(out,(char *)xmlbuff); 1766 FCGX_FFlush(out); 1767 } 1769 1768 /* 1770 1769 * Free associated memory. … … 2099 2098 * @param s the map containing the text,code,locator keys 2100 2099 */ 2101 void printExceptionReportResponse(maps* m,map* s ){2100 void printExceptionReportResponse(maps* m,map* s,FCGX_Stream * out){ 2102 2101 if(getMapFromMaps(m,"lenv","hasPrinted")!=NULL) 2103 2102 return; … … 2135 2134 if(tmpSid!=NULL){ 2136 2135 if( getpid()==atoi(tmpSid->value) ){ 2137 printHeaders(m );2138 printf("Content-Type: text/xml; charset=%s\r\nStatus: %s\r\n\r\n",encoding,exceptionCode);2139 2136 printHeaders(m,out); 2137 FCGX_FPrintF(out,"Content-Type: text/xml; charset=%s\r\nStatus: %s\r\n\r\n",encoding, exceptionCode); 2138 } 2140 2139 } 2141 2140 else{ 2142 printHeaders(m );2143 printf("Content-Type: text/xml; charset=%s\r\nStatus: %s\r\n\r\n",encoding,exceptionCode);2141 printHeaders(m,out); 2142 FCGX_FPrintF(out,"Content-Type: text/xml; charset=%s\r\nStatus: %s\r\n\r\n",encoding, exceptionCode); 2144 2143 } 2145 2144 }else{ 2146 printf("Content-Type: text/xml; charset=%s\r\nStatus: %s\r\n\r\n",encoding,exceptionCode);2147 }2145 FCGX_FPrintF(out,"Content-Type: text/xml; charset=%s\r\nStatus: %s\r\n\r\n",encoding, exceptionCode); 2146 } 2148 2147 n=createExceptionReportNode(m,s,1); 2149 2148 xmlDocSetRootElement(doc, n); 2150 2149 xmlDocDumpFormatMemoryEnc(doc, &xmlbuff, &buffersize, encoding, 1); 2151 printf("%s",xmlbuff); 2152 fflush(stdout); 2150 FCGX_FPrintF(out,"%s",xmlbuff); 2151 FCGX_FFlush(out); 2152 2153 2153 xmlFreeDoc(doc); 2154 2154 xmlFree(xmlbuff); … … 2161 2161 /** 2162 2162 * Create an OWS ExceptionReport Node. 2163 * 2163 * FCGX_FPrintF(out,"Content-Type: text/xml; charset=%s\r\nStatus: %s\r\n\r\n",encoding, exceptionCode); 2164 2164 * @param m the conf maps 2165 2165 * @param s the map containing the text,code,locator keys … … 2241 2241 * @param locator the potential locator 2242 2242 */ 2243 int errorException(maps *m, const char *message, const char *errorcode, const char *locator )2243 int errorException(maps *m, const char *message, const char *errorcode, const char *locator,FCGX_Stream * out) 2244 2244 { 2245 2245 map* errormap = createMap("text", message); … … 2249 2249 else 2250 2250 addToMap(errormap,"locator", "NULL"); 2251 printExceptionReportResponse(m,errormap );2251 printExceptionReportResponse(m,errormap,out); 2252 2252 freeMap(&errormap); 2253 2253 free(errormap); … … 2267 2267 */ 2268 2268 void outputResponse(service* s,maps* request_inputs,maps* request_outputs, 2269 map* request_inputs1,int cpid,maps* m,int res ){2269 map* request_inputs1,int cpid,maps* m,int res,FCGX_Stream * out){ 2270 2270 #ifdef DEBUG 2271 2271 dumpMaps(request_inputs); … … 2278 2278 asRaw=1; 2279 2279 map* version=getMapFromMaps(m,"main","rversion"); 2280 int vid=getVersionId(version->value); 2281 2282 maps* tmpSess=getMaps(m,"senv"); 2280 int vid=getVersionId(version->value); 2281 maps* tmpSess=getMaps(m,"senv"); 2283 2282 if(tmpSess!=NULL){ 2284 2283 map *_tmp=getMapFromMaps(m,"lenv","cookie"); 2285 2284 char* sessId=NULL; 2286 2285 if(_tmp!=NULL){ 2287 printf("Set-Cookie: %s; HttpOnly\r\n",_tmp->value);2288 printf("P3P: CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"\r\n");2286 FCGX_FPrintF(out,"Set-Cookie: %s; HttpOnly\r\n",_tmp->value); 2287 FCGX_FPrintF(out,"P3P: CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"\r\n"); 2289 2288 char session_file_path[100]; 2290 2289 char *tmp1=strtok(_tmp->value,";"); … … 2314 2313 char tmpMsg[1024]; 2315 2314 sprintf(tmpMsg,_("Unable to create the file \"%s\" for storing the session maps."),session_file_path); 2316 errorException(m,tmpMsg,"InternalError",NULL );2315 errorException(m,tmpMsg,"InternalError",NULL,out); 2317 2316 2318 2317 return; … … 2323 2322 } 2324 2323 } 2325 2326 2324 if(res==SERVICE_FAILED){ 2327 2325 map *lenv; … … 2336 2334 sprintf(tmp0,"%s",_("Unable to run the Service. No more information was returned back by the Service.")); 2337 2335 } 2338 errorException(m,tmp0,"InternalError",NULL );2336 errorException(m,tmp0,"InternalError",NULL,out); 2339 2337 free(tmp0); 2340 2338 return; 2341 2339 } 2342 2343 2340 if(res==SERVICE_ACCEPTED && vid==1){ 2344 2341 map* statusInfo=createMap("Status","Accepted"); 2345 2342 map *usid=getMapFromMaps(m,"lenv","usid"); 2346 2343 addToMap(statusInfo,"JobID",usid->value); 2347 printStatusInfo(m,statusInfo,"Execute" );2344 printStatusInfo(m,statusInfo,"Execute",out); 2348 2345 freeMap(&statusInfo); 2349 2346 free(statusInfo); 2350 2347 return; 2351 2348 } 2352 2353 2349 map *tmp1=getMapFromMaps(m,"main","tmpPath"); 2354 2350 if(asRaw==0){ … … 2411 2407 getFileExtension(mtype != NULL ? mtype->value : NULL, file_ext, 32); 2412 2408 } 2413 2414 2409 file_name=(char*)malloc((strlen(s->name)+strlen(usid->value)+strlen(file_ext)+strlen(tmpI->name)+45)*sizeof(char)); 2415 2410 sprintf(file_name,"%s_%s_%s_%d.%s",s->name,tmpI->name,usid->value,itn,file_ext); … … 2422 2417 char tmpMsg[1024]; 2423 2418 sprintf(tmpMsg,_("Unable to create the file \"%s\" for storing the %s final result."),file_name,tmpI->name); 2424 errorException(m,tmpMsg,"InternalError",NULL );2419 errorException(m,tmpMsg,"InternalError",NULL,out); 2425 2420 free(file_name); 2426 2421 free(file_path); … … 2428 2423 } 2429 2424 free(file_path); 2430 2431 2425 toto=getMap(tmpI->content,"value"); 2432 2426 if(strcasecmp(format,"BoundingBoxData")!=0){ … … 2438 2432 fwrite(toto->value,1,strlen(toto->value)*sizeof(char),ofile); 2439 2433 }else{ 2440 printBoundingBoxDocument(m,tmpI,ofile );2434 printBoundingBoxDocument(m,tmpI,ofile,out); 2441 2435 } 2442 2436 fclose(ofile); 2443 2437 2444 2438 } 2445 2439 map *tmp2=getMapFromMaps(m,"main","tmpUrl"); 2446 2440 map *tmp3=getMapFromMaps(m,"main","serverAddress"); 2447 2441 char *file_url; … … 2473 2467 dumpMaps(m); 2474 2468 #endif 2469 2475 2470 printProcessResponse(m,request_inputs1,cpid, 2476 2471 s, s->name,res, // replace serviceProvider with serviceName in stored response file name 2477 2472 request_inputs, 2478 request_outputs); 2473 request_outputs,out); 2474 2479 2475 } 2480 2476 else{ … … 2492 2488 elements* e=getElements(s->outputs,tmpI->name); 2493 2489 if(e!=NULL && strcasecmp(e->format,"BoundingBoxData")==0){ 2494 printBoundingBoxDocument(m,tmpI,NULL );2490 printBoundingBoxDocument(m,tmpI,NULL,out); 2495 2491 }else{ 2496 2492 map *gfile=getMap(tmpI->content,"generated_file"); … … 2506 2502 char tmpMsg[1024]; 2507 2503 sprintf(tmpMsg,_("Wrong RawDataOutput parameter: unable to fetch any result for the given parameter name: \"%s\"."),tmpI->name); 2508 errorException(m,tmpMsg,"InvalidParameterValue","RawDataOutput" );2504 errorException(m,tmpMsg,"InvalidParameterValue","RawDataOutput",out); 2509 2505 return; 2510 2506 } 2511 2507 map* fname=getMapFromMaps(tmpI,tmpI->name,"filename"); 2512 2508 if(fname!=NULL) 2513 printf("Content-Disposition: attachment; filename=\"%s\"\r\n",fname->value);2509 FCGX_FPrintF(out,"Content-Disposition: attachment; filename=\"%s\"\r\n",fname->value); 2514 2510 map* rs=getMapFromMaps(tmpI,tmpI->name,"size"); 2515 2511 if(rs!=NULL) 2516 printf("Content-Length: %s\r\n",rs->value);2517 printHeaders(m );2512 FCGX_FPrintF(out,"Content-Length: %s\r\n",rs->value); 2513 printHeaders(m,out); 2518 2514 char mime[1024]; 2519 2515 map* mi=getMap(tmpI->content,"mimeType"); … … 2524 2520 #endif 2525 2521 map* en=getMap(tmpI->content,"encoding"); 2526 if(mi!=NULL && en!=NULL) 2527 sprintf(mime, 2528 "Content-Type: %s; charset=%s\r\nStatus: 200 OK\r\n\r\n", 2529 mi->value,en->value); 2530 else 2531 if(mi!=NULL) 2532 sprintf(mime, 2533 "Content-Type: %s; charset=UTF-8\r\nStatus: 200 OK\r\n\r\n", 2534 mi->value); 2535 else 2536 sprintf(mime,"Content-Type: text/plain; charset=utf-8\r\nStatus: 200 OK\r\n\r\n"); 2537 printf("%s",mime); 2538 if(rs!=NULL) 2539 fwrite(toto->value,1,atoi(rs->value),stdout); 2540 else 2541 fwrite(toto->value,1,strlen(toto->value),stdout); 2522 if(mi!=NULL && en!=NULL){ 2523 sprintf(mime,"Content-Type: %s; charset=%s\r\nStatus: 200 OK\r\n\r\n",mi->value,en->value); 2524 } 2525 else { 2526 if(mi!=NULL) 2527 sprintf(mime,"Content-Type: %s; charset=UTF-8\r\nStatus: 200 OK\r\n\r\n",mi->value); 2528 else 2529 sprintf(mime,"Content-Type: text/plain; charset=utf-8\r\nStatus: 200 OK\r\n\r\n"); 2530 } 2531 FCGX_FPrintF(out,"%s",mime); 2532 if(rs!=NULL){ 2533 FCGX_PutStr(toto->value,atoi(rs->value),out); 2534 } 2535 else { 2536 FCGX_PutStr(toto->value,strlen (toto->value),out); 2537 } 2538 FCGX_FFlush(out); 2542 2539 #ifdef DEBUG 2543 2540 dumpMap(toto); … … 2659 2656 * @see parseBoundingBox, printBoundingBox 2660 2657 */ 2661 void printBoundingBoxDocument(maps* m,maps* boundingbox,FILE* file){ 2662 if(file==NULL) 2663 rewind(stdout); 2658 void printBoundingBoxDocument(maps* m,maps* boundingbox,FILE* file,FCGX_Stream * out){ 2664 2659 xmlNodePtr n; 2665 2660 xmlDocPtr doc; … … 2675 2670 pid=atoi(tmp->value); 2676 2671 if(pid==getpid()){ 2677 printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding); 2678 } 2679 fflush(stdout); 2672 2673 FCGX_FPrintF(out,"Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding); 2674 } 2675 FCGX_FFlush(out); 2680 2676 } 2681 2677 … … 2695 2691 xmlDocDumpFormatMemoryEnc(doc, &xmlbuff, &buffersize, encoding, 1); 2696 2692 if(file==NULL) 2697 printf("%s",xmlbuff);2693 FCGX_FPrintF(out,"%s",xmlbuff); 2698 2694 else{ 2699 2695 fprintf(file,"%s",xmlbuff); … … 2723 2719 * @param req the WPS requests (GetResult, GetStatus or Dismiss) 2724 2720 */ 2725 void printStatusInfo(maps* conf,map* statusInfo,char* req ){2726 rewind(stdout);2721 void printStatusInfo(maps* conf,map* statusInfo,char* req,FCGX_Stream * out){ 2722 //rewind(stdout); 2727 2723 xmlNodePtr n,n1; 2728 2724 xmlDocPtr doc; … … 2733 2729 map *tmp; 2734 2730 int pid=0; 2735 printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding); 2731 2732 FCGX_FPrintF(out,"Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding); 2736 2733 2737 2734 map* version=getMapFromMaps(conf,"main","rversion"); 2738 2735 int vid=getVersionId(version->value); 2739 2740 2736 doc = xmlNewDoc(BAD_CAST "1.0"); 2741 2737 n1=printWPSHeader(doc,conf,req,"StatusInfo",version->value,1); … … 2772 2768 2773 2769 xmlDocDumpFormatMemoryEnc(doc, &xmlbuff, &buffersize, encoding, 1); 2774 printf("%s",xmlbuff); 2775 2770 FCGX_FPrintF(out,"%s",xmlbuff); 2776 2771 xmlFree(xmlbuff); 2777 2772 xmlFreeDoc(doc); -
branches/PublicaMundi_David_integration_01-devel/zoo-project/zoo-kernel/response_print.h
r677 r741 25 25 #ifndef ZOO_RESPONSE_PRINT_H 26 26 #define ZOO_RESPONSE_PRINT_H 1 27 28 #include <fcgiapp.h> 27 29 28 30 #pragma once … … 69 71 #include <direct.h> 70 72 #endif 71 #include <stdio.h> 73 72 74 #include <time.h> 73 75 #include <ctype.h> … … 201 203 void zooXmlCleanupDocs(); 202 204 203 void printExceptionReportResponse(maps*,map* );205 void printExceptionReportResponse(maps*,map*,FCGX_Stream *); 204 206 xmlNodePtr createExceptionReportNode(maps*,map*,int); 205 void printProcessResponse(maps*,map*,int,service*,const char*,int,maps*,maps* );207 void printProcessResponse(maps*,map*,int,service*,const char*,int,maps*,maps*,FCGX_Stream *); 206 208 xmlNodePtr printWPSHeader(xmlDocPtr,maps*,const char*,const char*,const char*,int); 207 209 xmlNodePtr printGetCapabilitiesHeader(xmlDocPtr,maps*,const char*); … … 209 211 void printDescribeProcessForProcess(maps*,xmlNodePtr,service*); 210 212 void printFullDescription(int,elements*,const char*,xmlNsPtr,xmlNsPtr,xmlNodePtr,int); 211 void printDocument(maps*,xmlDocPtr,int );213 void printDocument(maps*,xmlDocPtr,int,FCGX_Stream *); 212 214 void printDescription(xmlNodePtr,xmlNsPtr,const char*,map*,int); 213 215 void printIOType(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*,int); 214 216 map* parseBoundingBox(const char*); 215 217 void printBoundingBox(xmlNsPtr,xmlNodePtr,map*); 216 void printBoundingBoxDocument(maps*,maps*,FILE* );218 void printBoundingBoxDocument(maps*,maps*,FILE*,FCGX_Stream *); 217 219 void printOutputDefinitions(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*); 218 void printStatusInfo(maps*,map*,char* );219 220 void outputResponse(service*,maps*,maps*,map*,int,maps*,int );221 222 int errorException(maps *, const char *, const char *, const char* );220 void printStatusInfo(maps*,map*,char*,FCGX_Stream *); 221 222 void outputResponse(service*,maps*,maps*,map*,int,maps*,int,FCGX_Stream *); 223 224 int errorException(maps *, const char *, const char *, const char*,FCGX_Stream *); 223 225 224 226 xmlNodePtr soapEnvelope(maps*,xmlNodePtr); -
branches/PublicaMundi_David_integration_01-devel/zoo-project/zoo-kernel/server_internal.c
r657 r741 850 850 * @param req the request (GetStatus / GetResult) 851 851 */ 852 void runGetStatus(maps* conf,char* pid,char* req ){852 void runGetStatus(maps* conf,char* pid,char* req,FCGX_Stream* out){ 853 853 map* r_inputs = getMapFromMaps (conf, "main", "tmpPath"); 854 854 char *sid=getStatusId(conf,pid); 855 855 if(sid==NULL){ 856 856 errorException (conf, _("The JobID from the request does not match any of the Jobs running on this server"), 857 "NoSuchJob", pid );857 "NoSuchJob", pid,out); 858 858 }else{ 859 859 map* statusInfo=createMap("JobID",pid); … … 861 861 if(strncasecmp(req,"GetResult",strlen(req))==0){ 862 862 errorException (conf, _("The result for the requested JobID has not yet been generated. "), 863 "ResultNotReady", pid );863 "ResultNotReady", pid,out); 864 864 return; 865 865 } … … 885 885 if(result!=NULL){ 886 886 char *encoding=getEncoding(conf); 887 fprintf(stdout,"Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding);888 fprintf(stdout,"%s",result);889 fflush(stdout);887 FCGX_FPrintF(out,"Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding); 888 FCGX_FPrintF(out,"%s",result); 889 FCGX_FFlush(out); 890 890 freeMap(&statusInfo); 891 891 free(statusInfo); … … 893 893 }else{ 894 894 errorException (conf, _("The result for the requested JobID has not yet been generated. "), 895 "ResultNotReady", pid );895 "ResultNotReady", pid,out); 896 896 freeMap(&statusInfo); 897 897 free(statusInfo); … … 914 914 } 915 915 } 916 printStatusInfo(conf,statusInfo,req );916 printStatusInfo(conf,statusInfo,req,out); 917 917 freeMap(&statusInfo); 918 918 free(statusInfo); … … 927 927 * @param pid the service identifier (usid key from the [lenv] section) 928 928 */ 929 void runDismiss(maps* conf,char* pid ){929 void runDismiss(maps* conf,char* pid,FCGX_Stream* out){ 930 930 map* r_inputs = getMapFromMaps (conf, "main", "tmpPath"); 931 931 char *sid=getStatusId(conf,pid); 932 932 if(sid==NULL){ 933 933 errorException (conf, _("The JobID from the request does not match any of the Jobs running on this server"), 934 "NoSuchJob", pid );934 "NoSuchJob", pid,out); 935 935 }else{ 936 936 // We should send the Dismiss request to the target host if it differs … … 967 967 if(unlink(fileName)!=0){ 968 968 errorException (conf, _("The job cannot be removed, a file cannot be removed"), 969 "NoApplicableCode", NULL );969 "NoApplicableCode", NULL,out); 970 970 return; 971 971 } … … 978 978 map* statusInfo=createMap("JobID",pid); 979 979 addToMap(statusInfo,"Status","Dismissed"); 980 printStatusInfo(conf,statusInfo,"Dismiss" );980 printStatusInfo(conf,statusInfo,"Dismiss",out); 981 981 free(statusInfo); 982 982 } -
branches/PublicaMundi_David_integration_01-devel/zoo-project/zoo-kernel/server_internal.h
r654 r741 31 31 #include <openssl/bio.h> 32 32 #include <openssl/buffer.h> 33 33 #include <fcgiapp.h> 34 34 extern int conf_read(const char*,maps*); 35 35 … … 52 52 void parseIdentifier(maps*,char*,char*,char*); 53 53 void dumpMapsValuesToFiles(maps**,maps**); 54 void runDismiss(maps*,char* );55 void runGetStatus(maps*,char*,char* );54 void runDismiss(maps*,char*,FCGX_Stream*); 55 void runGetStatus(maps*,char*,char*,FCGX_Stream*); 56 56 57 57 int isValidLang(maps*,const char*); -
branches/PublicaMundi_David_integration_01-devel/zoo-project/zoo-kernel/service_internal.c
r654 r741 23 23 */ 24 24 25 #include "fcgi_stdio.h"26 25 #include "service_internal.h" 27 26 #ifdef USE_MS … … 293 292 294 293 #include <windows.h> 295 #include <fcgi_stdio.h>294 //#include <fcgi_stdio.h> 296 295 #include <stdio.h> 297 296 #include <conio.h> … … 689 688 VSILFILE * fichier=VSIFOpenL(dataSource,"rb"); 690 689 VSIStatBuf file_status; 691 VSIStat(dataSource, &file_status); 690 VSIStatL(dataSource,&file_status); 691 //file_status.st_size = 2500; 692 692 if(fichier==NULL){ 693 693 char tmp[1024]; -
branches/PublicaMundi_David_integration_01-devel/zoo-project/zoo-kernel/service_internal.h
r677 r741 26 26 #define ZOO_SERVICE_INTERNAL_H 1 27 27 28 29 #include <fcgiapp.h> 30 28 31 #pragma once 29 32 … … 37 40 #define TIME_SIZE 40 38 41 39 #include <libintl.h>42 //#include <libintl.h> 40 43 #include <locale.h> 41 44 /** … … 65 68 #define ZOO_LOCK_MAX_RETRY 10 66 69 67 #include <sys/stat.h> 68 #include <sys/types.h> 70 //#include <sys/stat.h> 71 //#include <sys/types.h> 72 69 73 #ifndef WIN32 70 74 #include <sys/ipc.h> -
branches/PublicaMundi_David_integration_01-devel/zoo-project/zoo-kernel/sqlapi.c
r654 r741 29 29 30 30 #include "sqlapi.h" 31 #include <fcgi_stdio.h>31 //#include <fcgi_stdio.h> 32 32 #include <stdlib.h> 33 33 … … 183 183 sprintf(sqlQuery,"INSERT INTO %s.files (uuid,filename,nature,name) VALUES ('%s','%s','%s',NULL);",schema->value,uusid->value,filename,type); 184 184 execSql(conf,sqlQuery); 185 free(sqlQuery); 185 186 cleanUpResultSet(conf); 186 187 } … … 206 207 uusid->value,sid->value,osid->value); 207 208 execSql(conf,sqlQuery); 209 free(sqlQuery); 208 210 cleanUpResultSet(conf); 209 211 } … … 229 231 sprintf(sqlQuery,"INSERT INTO %s.responses (content,uuid) VALUES ($$%s$$,$$%s$$);",schema->value,tmps,sid->value); 230 232 execSql(conf,sqlQuery); 233 free(sqlQuery); 234 free(tmps); 231 235 cleanUpResultSet(conf); 232 236 } … … 250 254 execSql(conf,sqlQuery); 251 255 cleanUpResultSet(conf); 256 free(sqlQuery); 252 257 return 0; 253 258 } … … 280 285 } 281 286 cleanUpResultSet(conf); 287 free(sqlQuery); 282 288 return (char*)tmp1; 283 289 } … … 316 322 tmp1=NULL; 317 323 cleanUpResultSet(conf); 324 free(sqlQuery); 318 325 return (char*)tmp1; 319 326 } … … 338 345 cleanUpResultSet(conf); 339 346 close_sql(conf); 347 free(sqlQuery); 340 348 end_sql(); 341 349 } … … 363 371 cleanUpResultSet(conf); 364 372 close_sql(conf); 373 free(sqlQuery); 365 374 end_sql(); 366 375 } … … 397 406 if(hasRes<0) 398 407 tmp1=NULL; 408 free(sqlQuery); 399 409 return (char*)tmp1; 400 410 } … … 429 439 if(hasRes<0) 430 440 addToMap(statusInfo,"Status","Failed"); 441 free(sqlQuery); 431 442 return; 432 443 } … … 460 471 } 461 472 cleanUpResultSet(conf); 473 free(sqlQuery); 462 474 return res; 463 475 } -
branches/PublicaMundi_David_integration_01-devel/zoo-project/zoo-kernel/ulinet.h
r630 r741 26 26 #define _ULINET_H 27 27 28 #include "fcgi_stdio.h"28 //#include "fcgi_stdio.h" 29 29 #include <stdlib.h> 30 30 #include <fcntl.h> -
branches/PublicaMundi_David_integration_01-devel/zoo-project/zoo-kernel/zoo_loader.c
r677 r741 1 /* 1 /** 2 2 * Author : Gérald FENOY 3 3 * … … 30 30 */ 31 31 #ifndef WIN32 32 /* 32 33 #include "fcgio.h" 33 #include "fcgi_config.h" 34 #include "fcgi_stdio.h" 35 #endif 34 #include "fcgi_config.h" 35 */ 36 //#include <stdio.h> 37 #include <unistd.h> 38 #include <fcgiapp.h> 39 #endif 40 #include <sys/wait.h> 41 #include <pthread.h> 36 42 #include <sys/types.h> 37 43 #include <unistd.h> 38 44 #include "service_internal.h" 39 #include "response_print.h"40 #include "zoo_zcfg.h"41 42 45 #ifdef WIN32 43 46 #include "windows.h" … … 45 48 #endif 46 49 47 extern "C" { 50 extern "C" 51 { 48 52 #include "cgic.h" 49 53 #include <libxml/tree.h> … … 52 56 #include <libxml/xpath.h> 53 57 #include <libxml/xpathInternals.h> 58 59 #include <string.h> 60 61 #include <stdlib.h> 62 #include <glib.h> 63 #include <sys/stat.h> 64 #include <ctype.h> 65 54 66 } 55 56 #include "service_internal.h" 67 #include "response_print.h" 68 #include "zoo_zcfg.h" 69 #include "zoo_json.h" 70 #include "zoo_amqp.h" 71 //#include "zoo_sql.h" 72 #include "server_internal.h" 57 73 #include "request_parser.h" 58 59 int runRequest(map**); 74 void 75 loadServiceAndRun (maps ** myMap, service * s1, map * request_inputs, 76 maps ** inputs, maps ** ioutputs, int *eres,FCGX_Stream *out, FCGX_Stream *err); 77 78 xmlXPathObjectPtr extractFromDoc (xmlDocPtr, const char *); 79 int runRequest (map **,struct cgi_env **,FCGX_Request *); 60 80 61 81 using namespace std; … … 68 88 #endif 69 89 70 /** 71 * Main entry point for cgic. 72 * @return 0 on sucess. 73 */ 74 int cgiMain(){ 75 /** 76 * We'll use cgiOut as the default output (stdout) to produce plain text 77 * response. 78 */ 79 dup2(fileno(cgiOut),fileno(stdout)); 90 91 static void PrintEnv(FCGX_Stream *out, char *label, char **envp) 92 { 93 FCGX_FPrintF(out, "%s:<br>\n<pre>\n", label); 94 for( ; *envp != NULL; envp++) { 95 FCGX_FPrintF(out, "%s\n", *envp); 96 } 97 FCGX_FPrintF(out, "</pre><p>\n"); 98 } 99 100 #define PATH_SOCKET "/tmp/zoo.sock" 101 #define THREAD_COUNT 50 102 static int counts[THREAD_COUNT]; 103 104 105 int process(FCGX_Request *request){ 106 107 int pid = getpid(); 108 struct cgi_env *cgi; 109 cgi = (struct cgi_env*)malloc(sizeof(struct cgi_env)); 110 cgiMain_init (NULL, NULL,&cgi,request); 111 char *strQuery = NULL; 112 if (cgi->cgiQueryString != NULL) 113 strQuery = zStrdup (cgi->cgiQueryString); 114 map *tmpMap = NULL; 115 116 if (strncmp (cgi->cgiContentType, "text/xml", 8) == 0 || 117 strncasecmp (cgi->cgiRequestMethod, "post", 4) == 0) 118 { 119 if (cgi->cgiContentLength == 0) 120 { 121 char *post_data = NULL; 122 int i = 0; 123 int ch = FCGX_GetChar(request->in); 124 while (ch != -1){ 125 { 126 i++; 127 if (post_data == NULL) 128 { 129 post_data=(char*)malloc(sizeof(char)); 130 post_data[i-1] = (char) ch; 131 } 132 else 133 { 134 post_data=(char*)realloc(post_data,i*sizeof(char)); 135 post_data[i-1] = (char) ch; 136 } 137 ch = FCGX_GetChar(request->in); 138 if (ch == -1 ){ 139 post_data=(char*)realloc(post_data,(i + 1)*sizeof(char)); 140 post_data[i] = '\0'; 141 } 142 } 143 cgi->cgiContentLength = i; 144 if (post_data == NULL && (strQuery == NULL || strlen (strQuery) == 0)) 145 { 146 return errorException (NULL, 147 "ZOO-Kernel failed to process your request cause the request was emtpty.", 148 "InternalError", NULL,request->out); 149 } 150 else 151 { 152 if (strQuery == NULL || strlen (strQuery) == 0) 153 tmpMap = createMap ("request", post_data); 154 } 155 if (post_data != NULL) 156 free (post_data); 157 } 158 } 159 else 160 { 161 char *post_data = new char[cgi->cgiContentLength + 1]; 162 int r = FCGX_GetStr(post_data,cgi->cgiContentLength,request->in); 163 if ( r > 0) 164 { 165 post_data[r] = '\0'; 166 cgi->cgiContentLength = r; 167 tmpMap = createMap ("request", post_data); 168 } 169 else 170 { 171 post_data[0] = '\0'; 172 char **array, **arrayStep; 173 if (cgiFormEntries (&array,&cgi) != cgiFormSuccess) 174 { 175 return 1; 176 } 177 arrayStep = array; 178 while (*arrayStep) 179 { 180 char *ivalue = new char[cgi->cgiContentLength]; 181 cgiFormStringNoNewlines (*arrayStep, ivalue, 182 cgi->cgiContentLength,&cgi); 183 char *tmpValueFinal = 184 (char *) 185 malloc ((strlen (*arrayStep) + strlen (ivalue) + 186 1) * sizeof (char)); 187 sprintf (tmpValueFinal, "%s=%s", *arrayStep, ivalue); 188 if (strlen (post_data) == 0) 189 { 190 sprintf (post_data, "%s", tmpValueFinal); 191 } 192 else 193 { 194 char *tmp = zStrdup (post_data); 195 sprintf (post_data, "%s&%s", tmp, tmpValueFinal); 196 free (tmp); 197 } 198 free (tmpValueFinal); 80 199 #ifdef DEBUG 81 fprintf(cgiOut,"Content-Type: text/plain; charset=utf-8\r\nStatus: 200 OK\r\n\r\n"); 82 fprintf(cgiOut,"Welcome on ZOO verbose debuging mode \r\n\r\n"); 83 fflush(cgiOut); 84 fprintf (stderr, "Addr:%s\n", cgiRemoteAddr); 85 fprintf (stderr, "RequestMethod: (%s) %d %d\n", cgiRequestMethod,strncasecmp(cgiRequestMethod,"post",4),strncmp(cgiContentType,"text/xml",8)==0 || strncasecmp(cgiRequestMethod,"post",4)==0); 86 fprintf (stderr, "Request: %s\n", cgiQueryString); 87 fprintf (stderr, "ContentType: %s\n", cgiContentType); 88 fprintf (stderr, "ContentLength: %d\n", cgiContentLength); 89 fflush(stderr); 90 #endif 91 92 93 init_services_conf ("/var/www/zoo-wps/cgi-bin","/var/www/zoo-wps/registry/"); 94 95 96 char *strQuery=NULL; 97 if(cgiQueryString!=NULL) 98 strQuery=zStrdup(cgiQueryString); 99 map* tmpMap=NULL; 100 101 if(strncmp(cgiContentType,"text/xml",8)==0 || 102 strncasecmp(cgiRequestMethod,"post",4)==0){ 103 if(cgiContentLength==0){ 104 char *buffer=new char[2]; 105 char *res=NULL; 106 int r=0; 107 while((r=fread(buffer,sizeof(char),1,cgiIn))){ 108 buffer[1]=0; 109 if(res==NULL){ 110 res=(char*)malloc(2*sizeof(char)); 111 sprintf(res,"%s",buffer); 112 } 113 else{ 114 res=(char*)realloc(res,(cgiContentLength+2)*sizeof(char)); 115 memcpy(res + cgiContentLength, buffer, sizeof(char)); 116 res[cgiContentLength+1]=0; 117 } 118 cgiContentLength+=r; 119 } 120 delete[] buffer; 121 if(res!=NULL && (strQuery==NULL || strlen(strQuery)==0)) 122 tmpMap=createMap("request",res); 123 if(res!=NULL) 124 free(res); 125 }else{ 126 char *buffer=new char[cgiContentLength+1]; 127 if(fread(buffer,sizeof(char),cgiContentLength,cgiIn)>0){ 128 buffer[cgiContentLength]=0; 129 tmpMap=createMap("request",buffer); 130 }else{ 131 buffer[0]=0; 132 char **array, **arrayStep; 133 if (cgiFormEntries(&array) != cgiFormSuccess) { 134 return 1; 135 } 136 arrayStep = array; 137 while (*arrayStep) { 138 char *ivalue=new char[cgiContentLength]; 139 cgiFormStringNoNewlines(*arrayStep, ivalue, cgiContentLength); 140 char* tmpValueFinal=(char*) malloc((strlen(*arrayStep)+strlen(ivalue)+2)*sizeof(char)); 141 sprintf(tmpValueFinal,"%s=%s",*arrayStep,ivalue); 142 143 if(strlen(buffer)==0){ 144 sprintf(buffer,"%s",tmpValueFinal); 145 }else{ 146 char *tmp=zStrdup(buffer); 147 sprintf(buffer,"%s&%s",tmp,tmpValueFinal); 148 free(tmp); 149 } 150 free(tmpValueFinal); 200 fprintf (stderr, "(( \n %s \n %s \n ))", *arrayStep, 201 ivalue); 202 #endif 203 delete[]ivalue; 204 arrayStep++; 205 } 206 if (tmpMap != NULL) 207 addToMap (tmpMap, "request", post_data); 208 else 209 tmpMap = createMap ("request", post_data); 210 } 211 delete[]post_data; 212 } 213 } 214 else 215 { 151 216 #ifdef DEBUG 152 fprintf(stderr,"(( \n %s \n %s \n ))",*arrayStep,ivalue); 153 #endif 154 delete[]ivalue; 155 arrayStep++; 156 } 157 if(tmpMap!=NULL) 158 addToMap(tmpMap,"request",buffer); 159 else 160 tmpMap=createMap("request",buffer); 161 } 162 delete[]buffer; 163 } 164 } 165 else{ 217 dumpMap (tmpMap); 218 #endif 219 220 char **array, **arrayStep; 221 if (cgiFormEntries (&array,&cgi) != cgiFormSuccess) 222 { 223 return 1; 224 } 225 arrayStep = array; 226 while (*arrayStep) 227 { 228 char *value = new char[cgi->cgiContentLength]; 229 cgiFormStringNoNewlines (*arrayStep, value, cgi->cgiContentLength,&cgi); 166 230 #ifdef DEBUG 167 dumpMap(tmpMap); 168 #endif 169 char **array, **arrayStep; 170 if (cgiFormEntries(&array) != cgiFormSuccess) { 171 return 1; 172 } 173 arrayStep = array; 174 while (*arrayStep) { 175 char *value=new char[cgiContentLength]; 176 cgiFormStringNoNewlines(*arrayStep, value, cgiContentLength); 177 #ifdef DEBUG 178 fprintf(stderr,"(( \n %s \n %s \n ))",*arrayStep,value); 179 #endif 231 fprintf (stderr, "(( \n %s \n %s \n ))", *arrayStep, value); 232 #endif 233 if (tmpMap != NULL) 234 addToMap (tmpMap, *arrayStep, value); 235 else 236 tmpMap = createMap (*arrayStep, value); 237 arrayStep++; 238 delete[]value; 239 } 240 cgiStringArrayFree (array); 241 } 242 180 243 #ifdef WIN32 181 char* tmp = url_decode(value); 182 if(tmpMap!=NULL) 183 addToMap(tmpMap,*arrayStep,tmp); 184 else 185 tmpMap=createMap(*arrayStep,tmp); 186 free(tmp); 187 #else 188 if(tmpMap!=NULL) 189 addToMap(tmpMap,*arrayStep,value); 190 else 191 tmpMap=createMap(*arrayStep,value); 192 #endif 193 arrayStep++; 194 delete[]value; 195 } 196 cgiStringArrayFree(array); 197 } 198 199 #ifdef WIN32 200 map *tmpReq=getMap(tmpMap,"rfile"); 201 if(tmpReq!=NULL){ 202 FILE *lf=fopen(tmpReq->value,"r"); 203 fseek(lf,0,SEEK_END); 204 long flen=ftell(lf); 205 fseek(lf,0,SEEK_SET); 206 char *buffer=(char*)malloc((flen+1)*sizeof(char)); 207 fread(buffer,flen,1,lf); 208 fclose(lf); 209 addToMap(tmpMap,"request",buffer); 210 free(buffer); 211 cgiContentLength=flen+9; 212 } 244 map *tmpReq = getMap (tmpMap, "rfile"); 245 if (tmpReq != NULL) 246 { 247 FILE *lf = fopen (tmpReq->value, "r"); 248 fseek (lf, 0, SEEK_END); 249 long flen = ftell (lf); 250 fseek (lf, 0, SEEK_SET); 251 char *buffer = (char *) malloc ((flen + 1) * sizeof (char)); 252 fread (buffer, flen, 1, lf); 253 fclose (lf); 254 addToMap (tmpMap, "request", buffer); 255 free (buffer); 256 cgiContentLength = flen + 9; 257 } 213 258 #endif 214 259 /** … … 217 262 * one. 218 263 */ 219 if(strncasecmp(cgiRequestMethod,"post",4)==0 ||220 (count(tmpMap)==1 && strncmp(tmpMap->value,"<",1)==0)264 if (strncasecmp (cgi->cgiRequestMethod, "post", 4) == 0 || 265 (count (tmpMap) == 1 && strncmp (tmpMap->value, "<", 1) == 0) 221 266 #ifdef WIN32 222 ||tmpReq!=NULL 223 #endif 224 ){ 267 || tmpReq != NULL 268 #endif 269 ) 270 { 225 271 /** 226 272 * Store the original XML request in xrequest map 227 273 */ 228 map* t1=getMap(tmpMap,"request"); 229 if(t1!=NULL && strncasecmp(t1->value,"<",1)==0) { 230 addToMap(tmpMap,"xrequest",t1->value); 231 xmlInitParser(); 232 xmlDocPtr doc = xmlParseMemory(t1->value,cgiContentLength); 274 map *t1 = getMap (tmpMap, "request"); 275 if (t1 != NULL && strncasecmp (t1->value, "<", 1) == 0) 276 { 277 addToMap (tmpMap, "xrequest", t1->value); 278 xmlInitParser (); 279 xmlDocPtr doc = xmlParseMemory (t1->value, cgi->cgiContentLength); 280 { 281 xmlXPathObjectPtr reqptr = extractFromDoc (doc, 282 "/*[local-name()='Envelope']/*[local-name()='Body']/*"); 283 if (reqptr != NULL) 284 { 285 xmlNodeSet *req = reqptr->nodesetval; 286 if (req != NULL && req->nodeNr == 1) 287 { 288 addToMap (tmpMap, "soap", "true"); 289 for (int k = 0; k < req->nodeNr; k++) 290 { 291 //xmlNsPtr ns=xmlNewNs(req->nodeTab[k],BAD_CAST "http://www.w3.org/2001/XMLSchema-instance",BAD_CAST "xsi"); 292 xmlDocSetRootElement (doc, req->nodeTab[k]); 293 xmlChar *xmlbuff; 294 int buffersize; 295 xmlDocDumpFormatMemoryEnc (doc, &xmlbuff, 296 &buffersize, "utf-8", 297 1); 298 addToMap (tmpMap, "xrequest", (char *) xmlbuff); 299 xmlFree (xmlbuff); 300 } 301 } 302 xmlXPathFreeObject (reqptr); 303 } 304 } 305 306 xmlNodePtr cur = xmlDocGetRootElement (doc); 307 char *tval; 308 tval = NULL; 309 tval = (char *) xmlGetProp (cur, BAD_CAST "service"); 310 if (tval != NULL) 311 { 312 addToMap (tmpMap, "service", tval); 313 xmlFree (tval); 314 } 315 tval = NULL; 316 tval = (char *) xmlGetProp (cur, BAD_CAST "language"); 317 if (tval != NULL) 318 { 319 addToMap (tmpMap, "language", tval); 320 xmlFree (tval); 321 } 322 const char *requests[3] = 323 { "GetCapabilities", "DescribeProcess", "Execute" }; 324 for (int j = 0; j < 3; j++) 325 { 326 char tt[128]; 327 sprintf (tt, "/*[local-name()='%s']", requests[j]); 328 xmlXPathObjectPtr reqptr = extractFromDoc (doc, tt); 329 if (reqptr != NULL) 330 { 331 xmlNodeSet *req = reqptr->nodesetval; 332 #ifdef DEBUG 333 fprintf (stderr, "%i", req->nodeNr); 334 #endif 335 if (req != NULL && req->nodeNr == 1) 336 { 337 if (t1->value != NULL) 338 free (t1->value); 339 t1->value = zStrdup (requests[j]); 340 j = 2; 341 } 342 xmlXPathFreeObject (reqptr); 343 } 344 } 345 if (strncasecmp (t1->value, "GetCapabilities", 15) == 0) 346 { 347 xmlXPathObjectPtr versptr = 348 extractFromDoc (doc, "/*/*/*[local-name()='Version']"); 349 xmlNodeSet *vers = versptr->nodesetval; 350 xmlChar *content = xmlNodeListGetString (doc, 351 vers-> 352 nodeTab 353 [0]->xmlChildrenNode, 354 1); 355 addToMap (tmpMap, "version", (char *) content); 356 xmlXPathFreeObject (versptr); 357 xmlFree (content); 358 } 359 else 360 { 361 tval = NULL; 362 tval = (char *) xmlGetProp (cur, BAD_CAST "version"); 363 if (tval != NULL) 364 { 365 addToMap (tmpMap, "version", tval); 366 xmlFree (tval); 367 } 368 tval = (char *) xmlGetProp (cur, BAD_CAST "language"); 369 if (tval != NULL) 370 { 371 addToMap (tmpMap, "language", tval); 372 xmlFree (tval); 373 } 374 xmlXPathObjectPtr idptr = 375 extractFromDoc (doc, "/*/*[local-name()='Identifier']"); 376 if (idptr != NULL) 377 { 378 xmlNodeSet *id = idptr->nodesetval; 379 if (id != NULL) 380 { 381 char *identifiers = NULL; 382 identifiers = 383 (char *) calloc (cgi->cgiContentLength, sizeof (char)); 384 identifiers[0] = 0; 385 for (int k = 0; k < id->nodeNr; k++) 386 { 387 xmlChar *content = xmlNodeListGetString (doc, 388 id->nodeTab 389 [k]-> 390 xmlChildrenNode, 391 1); 392 if (strlen (identifiers) > 0) 393 { 394 char *tmp = zStrdup (identifiers); 395 snprintf (identifiers, 396 strlen (tmp) + 397 xmlStrlen (content) + 2, "%s,%s", 398 tmp, content); 399 free (tmp); 400 } 401 else 402 { 403 snprintf (identifiers, 404 xmlStrlen (content) + 1, "%s", 405 content); 406 } 407 xmlFree (content); 408 } 409 xmlXPathFreeObject (idptr); 410 addToMap (tmpMap, "Identifier", identifiers); 411 free (identifiers); 412 } 413 } 414 } 415 xmlFreeDoc (doc); 416 xmlCleanupParser (); 417 } 418 else 419 { 420 freeMap (&tmpMap); 421 free (tmpMap); 422 tmpMap = createMap ("not_valid", "true"); 423 } 424 425 char *token, *saveptr; 426 token = strtok_r (cgi->cgiQueryString, "&", &saveptr); 427 while (token != NULL) 428 { 429 char *token1, *saveptr1; 430 char *name = NULL; 431 char *value = NULL; 432 token1 = strtok_r (token, "=", &saveptr1); 433 while (token1 != NULL) 434 { 435 if (name == NULL) 436 name = zStrdup (token1); 437 else 438 value = zStrdup (token1); 439 token1 = strtok_r (NULL, "=", &saveptr1); 440 } 441 addToMap (tmpMap, name, value); 442 free (name); 443 free (value); 444 name = NULL; 445 value = NULL; 446 token = strtok_r (NULL, "&", &saveptr); 447 } 448 449 } 450 451 if (strncasecmp (cgi->cgiContentType, "multipart/form-data", 19) == 0) 452 { 453 map *tmp = getMap (tmpMap, "dataInputs"); 454 if (tmp != NULL) 455 { 456 addToMap (tmpMap, "dataInputs", 457 strstr (strQuery, "dataInputs=") + 11); 458 } 459 } 460 461 if (strQuery != NULL) 462 free (strQuery); 463 /* 464 json_object *obj; 465 maptojson(&obj,tmpMap); 466 fprintf(stderr,"%s\n",json_object_to_json_string(obj)); 467 fflush(stderr); 468 */ 469 runRequest (&tmpMap,&cgi,request); 470 471 /** 472 * Required but can't be made after executing a process using POST requests. 473 */ 474 if ( /*strncasecmp(cgiRequestMethod,"post",4)!=0 && count(tmpMap)!=1 && */ tmpMap != NULL) 475 { 476 freeMap (&tmpMap); 477 free (tmpMap); 478 } 479 // a verifier fait planter 480 cgiFreeResources (&cgi); 481 482 FCGX_Finish_r(request); 483 return 0; 484 } 485 486 487 488 int 489 main (int argc, char *argv[]) 490 { 491 int debug_flag = 0; 492 int background_flag = 0; 493 char *file_value = NULL; 494 int index; 495 int c; 496 opterr = 0; 497 while ((c = getopt (argc, argv, "dbhf:")) != -1) 498 switch (c) 233 499 { 234 xmlXPathObjectPtr reqptr=extractFromDoc(doc,"/*[local-name()='Envelope']/*[local-name()='Body']/*"); 235 if(reqptr!=NULL){ 236 xmlNodeSet* req=reqptr->nodesetval; 237 if(req!=NULL && req->nodeNr==1){ 238 addToMap(tmpMap,"soap","true"); 239 for(int k=0;k < req->nodeNr;k++){ 240 xmlDocSetRootElement(doc, req->nodeTab[k]); 241 xmlChar *xmlbuff; 242 int buffersize; 243 xmlDocDumpFormatMemoryEnc(doc, &xmlbuff, &buffersize, "utf-8", 1); 244 addToMap(tmpMap,"xrequest",(char*)xmlbuff); 245 xmlFree(xmlbuff); 246 } 247 } 248 xmlXPathFreeObject(reqptr); 249 } 500 case 'd': 501 debug_flag = 1; 502 break; 503 case 'b': 504 background_flag = 1; 505 break; 506 case 'h': 507 fprintf(stderr,"TODO: need to print help\n"); 508 fflush(stderr); 509 return 0; 510 case 'f': 511 file_value = optarg; 512 break; 513 case '?': 514 if (optopt == 'f') 515 fprintf (stderr, "Option -%c requires an argument.\n", optopt); 516 else if (isprint (optopt)) 517 fprintf (stderr, "Unknown option `-%c'.\n", optopt); 518 else 519 fprintf (stderr,"Unknown option character `\\x%x'.\n",optopt); 520 return 1; 521 default: 522 abort (); 250 523 } 251 524 252 xmlNodePtr cur = xmlDocGetRootElement(doc); 253 char *tval; 254 tval=NULL; 255 tval = (char*) xmlGetProp(cur,BAD_CAST "service"); 256 if(tval!=NULL){ 257 addToMap(tmpMap,"service",tval); 258 xmlFree(tval); 259 } 260 tval=NULL; 261 tval = (char*) xmlGetProp(cur,BAD_CAST "language"); 262 if(tval!=NULL){ 263 addToMap(tmpMap,"language",tval); 264 xmlFree(tval); 265 } 266 const char* requests[3]={"GetCapabilities","DescribeProcess","Execute"}; 267 for(int j=0;j<3;j++){ 268 char tt[128]; 269 sprintf(tt,"/*[local-name()='%s']",requests[j]); 270 xmlXPathObjectPtr reqptr=extractFromDoc(doc,tt); 271 if(reqptr!=NULL){ 272 xmlNodeSet* req=reqptr->nodesetval; 273 #ifdef DEBUG 274 fprintf(stderr,"%i",req->nodeNr); 275 #endif 276 if(req!=NULL && req->nodeNr==1){ 277 if(t1->value!=NULL) 278 free(t1->value); 279 t1->value=zStrdup(requests[j]); 280 j=2; 281 } 282 xmlXPathFreeObject(reqptr); 283 } 284 } 285 if(strncasecmp(t1->value,"GetCapabilities",15)==0){ 286 xmlXPathObjectPtr versptr=extractFromDoc(doc,"/*/*/*[local-name()='Version']"); 287 xmlNodeSet* vers=versptr->nodesetval; 288 if(vers!=NULL && vers->nodeTab!=NULL && vers->nodeTab[0]!=NULL){ 289 xmlChar* content=xmlNodeListGetString(doc, vers->nodeTab[0]->xmlChildrenNode,1); 290 addToMap(tmpMap,"version",(char*)content); 291 xmlFree(content); 292 } 293 if(cur->ns){ 294 addToMap(tmpMap,"wps_schemas",(char*)cur->ns->href); 295 int j=0; 296 for(j=0;j<2;j++) 297 if(strncasecmp(schemas[j][2],(char*)cur->ns->href,strlen(schemas[j][2]))==0){ 298 char vers[6]; 299 sprintf(vers,"%d.0.0",j+1); 300 addToMap(tmpMap,"version",(char*)vers); 301 } 302 } 303 xmlXPathFreeObject(versptr); 304 }else{ 305 tval=NULL; 306 tval = (char*) xmlGetProp(cur,BAD_CAST "version"); 307 if(tval!=NULL){ 308 addToMap(tmpMap,"version",tval); 309 xmlFree(tval); 310 } 311 tval = (char*) xmlGetProp(cur,BAD_CAST "language"); 312 if(tval!=NULL){ 313 addToMap(tmpMap,"language",tval); 314 xmlFree(tval); 315 } 316 xmlXPathObjectPtr idptr=extractFromDoc(doc,"/*/*[local-name()='Identifier']"); 317 if(idptr!=NULL){ 318 xmlNodeSet* id=idptr->nodesetval; 319 if(id!=NULL){ 320 char* identifiers=NULL; 321 identifiers=(char*)calloc(cgiContentLength,sizeof(char)); 322 identifiers[0]=0; 323 for(int k=0;k<id->nodeNr;k++){ 324 xmlChar* content=xmlNodeListGetString(doc, id->nodeTab[k]->xmlChildrenNode,1); 325 if(strlen(identifiers)>0){ 326 char *tmp=zStrdup(identifiers); 327 snprintf(identifiers,strlen(tmp)+xmlStrlen(content)+2,"%s,%s",tmp,content); 328 free(tmp); 329 } 330 else{ 331 snprintf(identifiers,xmlStrlen(content)+1,"%s",content); 332 } 333 xmlFree(content); 334 } 335 xmlXPathFreeObject(idptr); 336 addToMap(tmpMap,"Identifier",identifiers); 337 free(identifiers); 338 } 339 }else{ 340 idptr=extractFromDoc(doc,"/*/*[local-name()='JobID']"); 341 if(idptr!=NULL){ 342 xmlNodeSet* id=idptr->nodesetval; 343 if(id!=NULL){ 344 char* identifiers=NULL; 345 identifiers=(char*)calloc(cgiContentLength,sizeof(char)); 346 identifiers[0]=0; 347 for(int k=0;k<id->nodeNr;k++){ 348 xmlChar* content=xmlNodeListGetString(doc, id->nodeTab[k]->xmlChildrenNode,1); 349 if(strlen(identifiers)>0){ 350 char *tmp=zStrdup(identifiers); 351 snprintf(identifiers,strlen(tmp)+xmlStrlen(content)+2,"%s,%s",tmp,content); 352 free(tmp); 353 } 354 else{ 355 snprintf(identifiers,xmlStrlen(content)+1,"%s",content); 356 } 357 xmlFree(content); 358 } 359 xmlXPathFreeObject(idptr); 360 addToMap(tmpMap,"JobID",identifiers); 361 free(identifiers); 362 } 363 } 364 } 365 } 366 xmlFreeDoc(doc); 367 xmlCleanupParser(); 368 }else{ 369 freeMap(&tmpMap); 370 free(tmpMap); 371 tmpMap=createMap("not_valid","true"); 372 } 373 374 char *token,*saveptr; 375 token=strtok_r(cgiQueryString,"&",&saveptr); 376 while(token!=NULL){ 377 char *token1,*saveptr1; 378 char *name=NULL; 379 char *value=NULL; 380 token1=strtok_r(token,"=",&saveptr1); 381 while(token1!=NULL){ 382 if(name==NULL) 383 name=zStrdup(token1); 384 else 385 value=zStrdup(token1); 386 token1=strtok_r(NULL,"=",&saveptr1); 387 } 388 //addToMap(tmpMap,name,value); 389 /* knut: strtok(_r) ignores delimiter bytes at start and end of string; 390 * it will return non-empty string or NULL, e.g. "metapath=" yields value=NULL. 391 * This modification sets value="" instead of NULL. 392 */ 393 addToMap(tmpMap,name, value != NULL ? value : ""); 394 395 free(name); 396 free(value); 397 name=NULL; 398 value=NULL; 399 token=strtok_r(NULL,"&",&saveptr); 400 } 401 402 } 403 404 if(strncasecmp(cgiContentType,"multipart/form-data",19)==0){ 405 map* tmp=getMap(tmpMap,"dataInputs"); 406 if(tmp!=NULL){ 407 addToMap(tmpMap,"dataInputs",strstr(strQuery,"dataInputs=")+11); 408 } 409 } 410 411 if(strQuery!=NULL) 412 free(strQuery); 413 525 526 maps *conf; 527 conf = (maps *) malloc (MAPS_SIZE); 414 528 415 runRequest(&tmpMap); 416 417 if(tmpMap!=NULL){ 418 freeMap(&tmpMap); 419 free(tmpMap); 420 } 529 int ret = conf_read (file_value, conf); 530 if ( ret == 2){ 531 //a verifier mais conf_read ne renvoie jamais 0 532 fprintf(stderr,"Erreur lors de la lecture de %s\n",file_value); 533 return 1; 534 } 535 /* 536 json_object *jobj; 537 mapstojson(&jobj,conf); 538 fprintf (stderr,"The json object created: %s\n",json_object_to_json_string(jobj)); 539 freeMaps(&conf); 540 541 maps *conf_tmp; 542 jsontomaps(jobj,&conf_tmp); 543 dumpMaps(conf_tmp); 544 return 1; 545 */ 546 char *rootDir; 547 map *m_rootDir = getMapFromMaps (conf, "server", "rootDir"); 548 if (m_rootDir == NULL){ 549 fprintf(stderr,"Configuration error: rootDir"); 550 return 2; 551 } 552 else { 553 rootDir = (char*)malloc((strlen(m_rootDir->value) +1)*sizeof(char*)); 554 strncpy(rootDir,m_rootDir->value,strlen(m_rootDir->value)); 555 rootDir[strlen(m_rootDir->value)] = '\0'; 556 //freeMap(&m_rootDir); 557 } 558 559 char *regDir; 560 map *m_regDir = getMapFromMaps (conf, "main", "registry"); 561 if (m_regDir == NULL){ 562 fprintf(stderr,"Configuration error: regDir"); 563 return 2; 564 } 565 else { 566 regDir = (char*)malloc((strlen(m_regDir->value) +1)*sizeof(char*)); 567 strncpy(regDir,m_regDir->value,strlen(m_regDir->value)); 568 regDir[strlen(m_regDir->value)] = '\0'; 569 } 570 571 572 573 int req_worker; 574 map *m_req_worker = getMapFromMaps (conf, "server", "req_worker"); 575 if (m_req_worker == NULL){ 576 fprintf(stderr,"Configuration error: req.worker not found\n"); 577 return 2; 578 } 579 else { 580 req_worker=atoi(m_req_worker->value); 581 //freeMap(&m_req_worker); 582 if (req_worker == 0){ 583 fprintf(stderr,"Configuration error: req.worker\n"); 584 return 2; 585 } 586 } 587 588 int async_worker; 589 map *m_async_worker = getMapFromMaps (conf, "server", "async_worker"); 590 if (m_async_worker == NULL){ 591 fprintf(stderr,"Configuration error: async_worker not found"); 592 return 2; 593 } 594 else { 595 async_worker = atoi(m_async_worker->value); 596 //freeMap(&m_async_worker); 597 if (async_worker == 0){ 598 fprintf(stderr,"Configuration error: req_worker"); 599 return 2; 600 } 601 } 602 603 int max_requests; 604 map *m_max_requests = getMapFromMaps (conf, "server", "max_requests"); 605 if (m_max_requests == NULL){ 606 fprintf(stderr,"Configuration error: max_requests"); 607 return 2; 608 } 609 else { 610 max_requests = atoi(m_max_requests->value); 611 //freeMap(&m_max_requests); 612 if (max_requests == 0){ 613 fprintf(stderr,"Configuration error: max_requests"); 614 return 2; 615 } 616 } 617 618 map *m_listen = getMapFromMaps (conf, "server", "listen"); 619 char *listen; 620 if (m_listen == NULL){ 621 fprintf(stderr,"Configuration error: listen not found"); 622 return 2; 623 } 624 else { 625 listen = (char *)malloc((strlen(m_listen->value) +1)*sizeof(char*)); 626 strncpy(listen,m_listen->value,strlen(m_listen->value)); 627 listen[strlen(m_listen->value)] = '\0'; 628 //freeMap(&m_listen); 629 } 630 int listen_owner; 631 map *m_listen_owner = getMapFromMaps (conf, "server", "listen_owner"); 632 if (m_listen_owner == NULL){ 633 fprintf(stderr,"Configuration error: listen_owner"); 634 return 2; 635 } 636 else { 637 listen_owner = atoi(m_listen_owner->value); 638 //freeMap(&m_listen_owner); 639 if (listen_owner == 0){ 640 fprintf(stderr,"Configuration error: listen_owner"); 641 return 2; 642 } 643 } 644 645 int listen_group; 646 map *m_listen_group = getMapFromMaps (conf, "server", "listen_group"); 647 if (m_listen_group == NULL){ 648 fprintf(stderr,"Configuration error: listen_group"); 649 return 2; 650 } 651 else { 652 listen_group = atoi(m_listen_group->value); 653 //freeMap(&m_listen_group); 654 if (listen_group == 0){ 655 fprintf(stderr,"Configuration error: listen_group"); 656 return 2; 657 } 658 } 659 660 char * listen_mode; 661 map *m_listen_mode = getMapFromMaps (conf, "server", "listen_mode"); 662 if (m_listen_mode == NULL){ 663 fprintf(stderr,"Configuration error: listen_mode"); 664 return 2; 665 } 666 else { 667 listen_mode = (char *)malloc((strlen(m_listen_mode->value) +1)*sizeof(char*)); 668 strncpy(listen_mode,m_listen_mode->value,strlen(m_listen_mode->value)); 669 listen_mode[strlen(m_listen_mode->value)] = '\0'; 670 //freeMap(&m_listen_mode); 671 } 672 673 int listen_queue; 674 map *m_listen_queue = getMapFromMaps (conf, "server", "listen_queue"); 675 if (m_listen_queue == NULL){ 676 fprintf(stderr,"Configuration error: listen_queue"); 677 return 2; 678 } 679 else { 680 listen_queue = atoi(m_listen_queue->value); 681 //freeMap(&m_listen_queue); 682 if (listen_queue == 0){ 683 fprintf(stderr,"Configuration error: listen_queue"); 684 return 2; 685 } 686 } 687 688 int id_user; 689 map *m_user = getMapFromMaps (conf, "server", "uid"); 690 if (m_user == NULL){ 691 fprintf(stderr,"Configuration error: id_user"); 692 return 2; 693 } 694 else { 695 id_user = atoi(m_user->value); 696 //freeMap(&m_user); 697 if (id_user == 0){ 698 fprintf(stderr,"Configuration error: id_user"); 699 return 2; 700 } 701 } 702 703 704 int id_group; 705 map *m_group = getMapFromMaps (conf, "server", "gid"); 706 if (m_group == NULL){ 707 fprintf(stderr,"Configuration error: gid"); 708 return 2; 709 } 710 else { 711 id_group = atoi(m_group->value); 712 //freeMap(&m_group); 713 if (id_group == 0){ 714 fprintf(stderr,"Configuration error: id_group"); 715 return 2; 716 } 717 } 718 719 720 char * amqp_host; 721 map * m_amqp_host = getMapFromMaps (conf, "rabbitmq", "host"); 722 if (m_amqp_host == NULL){ 723 fprintf(stderr,"Configuration error: [rabbitmq] host"); 724 return 2; 725 } 726 else { 727 amqp_host = (char *)malloc((strlen(m_amqp_host->value) +1)*sizeof(char*)); 728 strncpy(amqp_host,m_amqp_host->value,strlen(m_amqp_host->value)); 729 amqp_host[strlen(m_amqp_host->value)] = '\0'; 730 } 731 732 int amqp_port; 733 map *m_amqp_port = getMapFromMaps (conf, "rabbitmq", "port"); 734 if (m_amqp_port == NULL){ 735 fprintf(stderr,"Configuration error: [rabbitmq] port"); 736 return 2; 737 } 738 else { 739 amqp_port = atoi(m_amqp_port->value); 740 if (amqp_port == 0){ 741 fprintf(stderr,"Configuration error: [rabbitmq] port"); 742 return 2; 743 } 744 } 745 746 char * amqp_user; 747 map * m_amqp_user = getMapFromMaps (conf, "rabbitmq", "user"); 748 if (m_amqp_user == NULL){ 749 fprintf(stderr,"Configuration error: [rabbitmq] user"); 750 return 2; 751 } 752 else { 753 amqp_user = (char *)malloc((strlen(m_amqp_user->value) +1)*sizeof(char*)); 754 strncpy(amqp_user,m_amqp_user->value,strlen(m_amqp_user->value)); 755 amqp_user[strlen(m_amqp_user->value)] = '\0'; 756 } 757 758 char * amqp_passwd; 759 map * m_amqp_passwd = getMapFromMaps (conf, "rabbitmq", "passwd"); 760 if (m_amqp_passwd == NULL){ 761 fprintf(stderr,"Configuration error: [rabbitmq] passwd"); 762 return 2; 763 } 764 else { 765 amqp_passwd = (char *)malloc((strlen(m_amqp_passwd->value) +1)*sizeof(char*)); 766 strncpy(amqp_passwd,m_amqp_passwd->value,strlen(m_amqp_passwd->value)); 767 amqp_passwd[strlen(m_amqp_passwd->value)] = '\0'; 768 } 769 770 char * amqp_exchange; 771 map * m_amqp_exchange = getMapFromMaps (conf, "rabbitmq", "exchange"); 772 if (m_amqp_exchange == NULL){ 773 fprintf(stderr,"Configuration error: [rabbitmq] exchange"); 774 return 2; 775 } 776 else { 777 amqp_exchange = (char *)malloc((strlen(m_amqp_exchange->value) +1)*sizeof(char*)); 778 strncpy(amqp_exchange,m_amqp_exchange->value,strlen(m_amqp_exchange->value)); 779 amqp_exchange[strlen(m_amqp_exchange->value)] = '\0'; 780 } 781 782 char * amqp_routingkey; 783 map * m_amqp_routingkey = getMapFromMaps (conf, "rabbitmq", "routingkey"); 784 if (m_amqp_routingkey == NULL){ 785 fprintf(stderr,"Configuration error: [amqp] routingkey"); 786 return 2; 787 } 788 else { 789 amqp_routingkey = (char *)malloc((strlen(m_amqp_routingkey->value) +1)*sizeof(char*)); 790 strncpy(amqp_routingkey,m_amqp_routingkey->value,strlen(m_amqp_routingkey->value)); 791 amqp_routingkey[strlen(m_amqp_routingkey->value)] = '\0'; 792 } 793 794 char * amqp_queue; 795 map * m_amqp_queue = getMapFromMaps (conf, "rabbitmq", "queue"); 796 if (m_amqp_queue == NULL){ 797 fprintf(stderr,"Configuration error: [rabbitmq] queue"); 798 return 2; 799 } 800 else { 801 amqp_queue = (char *)malloc((strlen(m_amqp_queue->value) +1)*sizeof(char*)); 802 strncpy(amqp_queue,m_amqp_queue->value,strlen(m_amqp_queue->value)); 803 amqp_queue[strlen(m_amqp_queue->value)] = '\0'; 804 } 805 /* 806 char * status_user; 807 map * m_status_user = getMapFromMaps (conf, "status", "user"); 808 if (m_status_user == NULL){ 809 fprintf(stderr,"Configuration error: [status] user"); 810 return 2; 811 } 812 else { 813 status_user = (char *)malloc((strlen(m_status_user->value) +1)*sizeof(char*)); 814 strncpy(status_user,m_status_user->value,strlen(m_status_user->value)); 815 status_user[strlen(m_status_user->value)] = '\0'; 816 } 817 818 819 char * status_passwd; 820 map * m_status_passwd = getMapFromMaps (conf, "status", "passwd"); 821 if (m_status_passwd == NULL){ 822 fprintf(stderr,"Configuration error: [status] passwd"); 823 return 2; 824 } 825 else { 826 status_passwd = (char *)malloc((strlen(m_status_passwd->value) +1)*sizeof(char*)); 827 strncpy(status_passwd,m_status_passwd->value,strlen(m_status_passwd->value)); 828 status_passwd[strlen(m_status_passwd->value)] = '\0'; 829 } 830 831 char * status_bdd; 832 map * m_status_bdd = getMapFromMaps (conf, "status", "bdd"); 833 if (m_status_bdd == NULL){ 834 fprintf(stderr,"Configuration error: [status] bdd"); 835 return 2; 836 } 837 else { 838 status_bdd = (char *)malloc((strlen(m_status_bdd->value) +1)*sizeof(char*)); 839 strncpy(status_bdd,m_status_bdd->value,strlen(m_status_bdd->value)); 840 status_bdd[strlen(m_status_bdd->value)] = '\0'; 841 } 842 843 char * status_host; 844 map * m_status_host = getMapFromMaps (conf, "status", "host"); 845 if (m_status_host == NULL){ 846 fprintf(stderr,"Configuration error: [status] host"); 847 return 2; 848 } 849 else { 850 status_host = (char *)malloc((strlen(m_status_host->value) +1)*sizeof(char*)); 851 strncpy(status_host,m_status_host->value,strlen(m_status_host->value)); 852 status_host[strlen(m_status_host->value)] = '\0'; 853 } 854 855 int status_port; 856 map *m_status_port = getMapFromMaps (conf, "status", "port"); 857 if (m_status_port == NULL){ 858 fprintf(stderr,"Configuration error: [status] port"); 859 return 2; 860 } 861 else { 862 status_port = atoi(m_status_port->value); 863 if (status_port == 0){ 864 fprintf(stderr,"Configuration error: [status] port"); 865 return 2; 866 } 867 } 868 */ 869 int sock = FCGX_OpenSocket(listen, listen_queue); 870 init_services_conf (rootDir,regDir); 871 872 ret = chown(listen, listen_owner, listen_group); 873 if (ret != 0){ 874 fprintf(stderr,"Change owner error on : %s\n",listen); 875 return 3; 876 } 877 /* 878 ret = setgid(id_group); 879 if (ret != 0){ 880 fprintf(stderr,"Change gid error\n"); 881 return 3; 882 } 883 884 ret = setuid(id_user); 885 if (ret != 0){ 886 fprintf(stderr,"Change uid error\n"); 887 return 3; 888 } 889 */ 890 891 #ifdef AMQP 892 init_amqp(amqp_host,amqp_port,amqp_user, amqp_passwd, amqp_exchange, amqp_routingkey,amqp_queue); 893 #endif 894 895 int fork_status = fork(); 896 if (fork_status == 0){ 897 //child 898 int master_sync= getpid(); 899 fprintf(stderr,"Master sync%d\n",getpid()); 900 FCGX_Init(); 901 FCGX_Request request; 902 FCGX_InitRequest(&request, sock, 0); 903 int i; 904 int count_request = 0; 905 for (i = 0; i< req_worker; i++){ 906 fork_status = fork(); 907 if (fork_status == 0){ 908 fprintf(stderr,"child sync %d \n",getpid()); 909 fflush(stderr); 910 break; 911 } 912 } 913 while(1){ 914 /* mode synchrone */ 915 if (master_sync != getpid()){ 916 while(FCGX_Accept_r(&request) == 0){ 917 process(&request); 918 count_request ++; 919 if (count_request >= max_requests){ 920 fprintf(stderr,"Max request stop process\n"); 921 fflush(stderr); 922 exit(0); 923 } 924 } 925 } 926 else { 927 wait(0); 928 fprintf(stderr,"Master sync %d\n",getpid()); 929 fprintf(stderr,"New sync Child\n"); 930 fflush(stderr); 931 fork(); 932 } 933 } 934 } 935 while(1); 936 421 937 return 0; 422 423 938 } 939 -
branches/PublicaMundi_David_integration_01-devel/zoo-project/zoo-kernel/zoo_service_loader.c
r677 r741 32 32 #endif 33 33 34 #include "cgic.h"34 //#include "cgic.h" 35 35 36 36 extern "C" … … 45 45 #include "ulinet.h" 46 46 47 #include <libintl.h>47 //#include <libintl.h> 48 48 #include <locale.h> 49 49 #include <string.h> … … 56 56 #include "request_parser.h" 57 57 #include "sqlapi.h" 58 #include "zoo_amqp.h" 59 #include "zoo_json.h" 58 60 59 61 #ifdef USE_PYTHON … … 237 239 ("ZOO Kernel failed to process your request, receiving signal %d = %s"), 238 240 sig, ssig); 239 errorException (NULL, tmp, "InternalError", NULL );241 errorException (NULL, tmp, "InternalError", NULL,NULL); 240 242 #ifdef DEBUG 241 243 fprintf (stderr, "Not this time!\n"); … … 256 258 void 257 259 loadServiceAndRun (maps ** myMap, service * s1, map * request_inputs, 258 maps ** inputs, maps ** ioutputs, int *eres )260 maps ** inputs, maps ** ioutputs, int *eres,FCGX_Stream *out, FCGX_Stream *err) 259 261 { 260 262 char tmps1[1024]; … … 386 388 typedef int (*execute_t) (maps **, maps **, maps **); 387 389 388 fprintf(stderr,"%s \n",s1->name);389 390 #ifdef WIN32 390 391 execute_t execute = … … 407 408 ("Error occured while running the %s function: %s"), 408 409 s1->name, errstr); 409 errorException (m, tmpMsg, "InternalError", NULL );410 errorException (m, tmpMsg, "InternalError", NULL,out); 410 411 free (tmpMsg); 411 412 #ifdef DEBUG … … 457 458 #endif 458 459 sprintf (tmps, _("Unable to load C Library %s"), errstr); 459 errorException(m,tmps,"InternalError",NULL );460 errorException(m,tmps,"InternalError",NULL,out); 460 461 *eres = -1; 461 462 } … … 553 554 ("Programming Language (%s) set in ZCFG file is not currently supported by ZOO Kernel.\n"), 554 555 r_inputs->value); 555 errorException (m, tmpv, "InternalError", NULL );556 errorException (m, tmpv, "InternalError", NULL,out); 556 557 *eres = -1; 557 558 } 559 fflush(stderr); 558 560 *myMap = m; 559 561 *ioutputs = request_output_real_format; … … 728 730 */ 729 731 int 730 runRequest (map ** inputs )732 runRequest (map ** inputs,struct cgi_env ** c,FCGX_Request *request) 731 733 { 732 734 struct cgi_env *cgi = *c; 735 char *cgiSid = cgi->cgiSid; 733 736 #ifndef USE_GDB 734 737 #ifndef WIN32 … … 757 760 { 758 761 return errorException (m, _("Unable to allocate memory."), 759 "InternalError", NULL );762 "InternalError", NULL,request->out); 760 763 } 761 764 char ntmp[1024]; … … 772 775 { 773 776 errorException (NULL, _("Unable to load the main.cfg file."), 774 "InternalError", NULL );777 "InternalError", NULL,request->out); 775 778 free (m); 776 779 return 1; … … 819 822 ("The value %s is not supported for the <language> parameter"), 820 823 r_inputs->value); 821 errorException (m, tmp, "InvalidParameterValue", "language" );824 errorException (m, tmp, "InvalidParameterValue", "language",request->out); 822 825 freeMaps (&m); 823 826 free (m); … … 870 873 setMapInMaps (m, "main", "isSoap", "false"); 871 874 872 if(strlen(cgi ServerName)>0)875 if(strlen(cgi->cgiServerName)>0) 873 876 { 874 877 char tmpUrl[1024]; 875 878 876 879 if ( getenv("HTTPS") != NULL && strncmp(getenv("HTTPS"), "on", 2) == 0 ) { // Knut: check if non-empty instead of "on"? 877 if ( strncmp(cgi ServerPort, "443", 3) == 0 ) {878 sprintf(tmpUrl, "https://%s%s", cgi ServerName,cgiScriptName);880 if ( strncmp(cgi->cgiServerPort, "443", 3) == 0 ) { 881 sprintf(tmpUrl, "https://%s%s", cgi->cgiServerName, cgi->cgiScriptName); 879 882 } 880 883 else { 881 sprintf(tmpUrl, "https://%s:%s%s", cgi ServerName, cgiServerPort,cgiScriptName);884 sprintf(tmpUrl, "https://%s:%s%s", cgi->cgiServerName, cgi->cgiServerPort, cgi->cgiScriptName); 882 885 } 883 886 } 884 887 else { 885 if ( strncmp(cgi ServerPort, "80", 2) == 0 ) {886 sprintf(tmpUrl, "http://%s%s", cgi ServerName,cgiScriptName);888 if ( strncmp(cgi->cgiServerPort, "80", 2) == 0 ) { 889 sprintf(tmpUrl, "http://%s%s", cgi->cgiServerName, cgi->cgiScriptName); 887 890 } 888 891 else { 889 sprintf(tmpUrl, "http://%s:%s%s", cgi ServerName, cgiServerPort,cgiScriptName);892 sprintf(tmpUrl, "http://%s:%s%s", cgi->cgiServerName, cgi->cgiServerPort, cgi->cgiScriptName); 890 893 } 891 894 } … … 913 916 if(err!=NULL){ 914 917 checkValidValue(request_inputs,&err,"service",(const char**)vvs,1); 915 printExceptionReportResponse (m, err );918 printExceptionReportResponse (m, err,request->out); 916 919 freeMap(&err); 917 920 free(err); … … 969 972 } 970 973 if(err!=NULL){ 971 printExceptionReportResponse (m, err );974 printExceptionReportResponse (m, err,request->out); 972 975 freeMap(&err); 973 976 free(err); … … 1024 1027 xmlNodePtr n=printGetCapabilitiesHeader(doc,m,(version!=NULL?version->value:"1.0.0")); 1025 1028 CapabilitiesAllProcess(m,n); 1029 1026 1030 /** 1027 1031 * Here we need to close stdout to ensure that unsupported chars 1028 1032 * has been found in the zcfg and then printed on stdout 1029 1033 */ 1030 /* 1031 int saved_stdout = dup (fileno (stdout)); 1032 dup2 (fileno (stderr), fileno (stdout)); 1033 if (int res = 1034 recursReaddirF (m, zooRegistry, n, conf_dir, NULL, saved_stdout, 0, 1035 printGetCapabilitiesForProcess) < 0) 1036 { 1037 freeMaps (&m); 1038 free (m); 1039 if(zooRegistry!=NULL){ 1040 freeRegistry(&zooRegistry); 1041 free(zooRegistry); 1042 } 1043 free (REQUEST); 1044 free (SERVICE_URL); 1045 fflush (stdout); 1046 return res; 1047 } 1048 fflush (stdout); 1049 dup2 (saved_stdout, fileno (stdout)); 1050 */ 1051 printDocument (m, doc, getpid ()); 1034 printDocument (m, doc, getpid (),request->out); 1052 1035 freeMaps (&m); 1053 1036 free (m); 1054 /*1055 if(zooRegistry!=NULL){1056 freeRegistry(&zooRegistry);1057 free(zooRegistry);1058 }1059 */1060 1037 free (REQUEST); 1061 1038 free (SERVICE_URL); 1062 fflush (stdout);1063 1039 return 0; 1064 1040 } … … 1069 1045 if (strncasecmp (REQUEST, "GetStatus", strlen(REQUEST)) == 0 || 1070 1046 strncasecmp (REQUEST, "GetResult", strlen(REQUEST)) == 0){ 1071 runGetStatus(m,r_inputs->value,REQUEST );1047 runGetStatus(m,r_inputs->value,REQUEST,request->out); 1072 1048 freeMaps (&m); 1073 1049 free (m); … … 1078 1054 else 1079 1055 if (strncasecmp (REQUEST, "Dismiss", strlen(REQUEST)) == 0){ 1080 runDismiss(m,r_inputs->value );1056 runDismiss(m,r_inputs->value,request->out); 1081 1057 freeMaps (&m); 1082 1058 free (m); … … 1091 1067 r_inputs = getMap (request_inputs, "Identifier"); 1092 1068 1093 struct dirent *dp;1094 DIR *dirp = opendir (conf_dir);1095 if (dirp == NULL)1096 {1097 errorException (m, _("The specified path path does not exist."),1098 "InvalidParameterValue", conf_dir);1099 freeMaps (&m);1100 free (m);1101 free (REQUEST);1102 free (SERVICE_URL);1103 return 0;1104 }1105 1069 if (strncasecmp (REQUEST, "DescribeProcess", 15) == 0) 1106 1070 { … … 1119 1083 1120 1084 DescribeProcess(m,n,orig); 1121 fflush (stdout);1122 1085 int saved_stdout; 1123 dup2 (saved_stdout, fileno (stdout));1124 1086 free (orig); 1125 printDocument (m, doc, getpid () );1087 printDocument (m, doc, getpid (),request->out); 1126 1088 freeMaps (&m); 1127 1089 free (m); 1128 1090 free (REQUEST); 1129 1091 free (SERVICE_URL); 1130 fflush (stdout);1131 1092 return 0; 1132 1093 } 1133 1094 else if (strncasecmp (REQUEST, "Execute", strlen (REQUEST)) != 0) 1134 1095 { 1135 1096 map* version=getMapFromMaps(m,"main","rversion"); 1136 1097 int vid=getVersionId(version->value); 1137 1098 int len,j=0; … … 1169 1130 char* message=(char*)malloc((61+len)*sizeof(char)); 1170 1131 sprintf(message,"The <request> value was not recognized. Allowed values are %s.",tmpStr); 1171 errorException (m,_(message),"InvalidParameterValue", "request" );1132 errorException (m,_(message),"InvalidParameterValue", "request",request->out); 1172 1133 #ifdef DEBUG 1173 1134 fprintf (stderr, "No request found %s", REQUEST); 1174 1135 #endif 1175 closedir (dirp);1176 1136 freeMaps (&m); 1177 1137 free (m); 1178 1138 free (REQUEST); 1179 1139 free (SERVICE_URL); 1180 fflush (stdout);1181 1140 return 0; 1182 1141 } 1183 closedir (dirp);1184 1142 } 1185 1143 } … … 1187 1145 map *postRequest = NULL; 1188 1146 postRequest = getMap (request_inputs, "xrequest"); 1189 1147 /* 1190 1148 if(vid==1 && postRequest==NULL){ 1191 errorException (m,_("Unable to run Execute request using the GET HTTP method"),"InvalidParameterValue", "request" );1149 errorException (m,_("Unable to run Execute request using the GET HTTP method"),"InvalidParameterValue", "request",request->out); 1192 1150 freeMaps (&m); 1193 1151 free (m); 1194 1152 free (REQUEST); 1195 1153 free (SERVICE_URL); 1196 fflush (stdout);1197 1154 return 0; 1198 1155 } 1199 1156 */ 1200 1157 s1 = NULL; 1201 1158 r_inputs = getMap (request_inputs, "Identifier"); 1202 1159 s1 = search_service (r_inputs->value); 1203 int saved_stdout = dup (fileno (stdout));1160 int saved_stdout;// = dup (fileno (stdout)); 1204 1161 1205 1162 … … 1211 1168 ("The value for <identifier> seems to be wrong (%s). Please specify one of the processes in the list returned by a GetCapabilities request."), 1212 1169 r_inputs->value); 1213 errorException (m, tmpMsg, "InvalidParameterValue", "identifier" );1170 errorException (m, tmpMsg, "InvalidParameterValue", "identifier",request->out); 1214 1171 free (tmpMsg); 1215 1172 freeMaps (&m); … … 1219 1176 return 0; 1220 1177 } 1221 close (saved_stdout); 1178 setMapInMaps (m, "lenv", "Identifier", r_inputs->value); 1179 setMapInMaps (m, "lenv", "oIdentifier", r_inputs->value); 1180 1222 1181 1223 1182 #ifdef DEBUG … … 1248 1207 1249 1208 1250 if(parseRequest(&m,&request_inputs,s1,&request_input_real_format,&request_output_real_format,&hInternet )<0){1209 if(parseRequest(&m,&request_inputs,s1,&request_input_real_format,&request_output_real_format,&hInternet,cgi)<0){ 1251 1210 freeMaps (&m); 1252 1211 free (m); … … 1334 1293 _ 1335 1294 ("The status parameter cannot be set to true if storeExecuteResponse is set to false. Please modify your request parameters."), 1336 "InvalidParameterValue", "storeExecuteResponse"); 1337 //freeService (&s1); 1338 free (s1); 1295 "InvalidParameterValue", "storeExecuteResponse",request->out); 1339 1296 freeMaps (&m); 1340 1297 free (m); … … 1361 1318 if(mode!=NULL){ 1362 1319 // see ref. http://docs.opengeospatial.org/is/14-065/14-065.html#61 1363 errorException (m,_("The process does not permit the desired execution mode."),"NoSuchMode", mode->value); 1364 fflush (stdout); 1320 errorException (m,_("The process does not permit the desired execution mode."),"NoSuchMode", mode->value,request->out); 1365 1321 freeMaps (&m); 1366 1322 free (m); … … 1440 1396 1441 1397 // Parse the session file and add it to the main maps 1442 if (cgi Cookie != NULL && strlen (cgiCookie) > 0)1398 if (cgi->cgiCookie != NULL && strlen (cgi->cgiCookie) > 0) 1443 1399 { 1444 1400 int hasValidCookie = -1; 1445 char *tcook = zStrdup (cgi Cookie);1401 char *tcook = zStrdup (cgi->cgiCookie); 1446 1402 char *tmp = NULL; 1447 1403 map *testing = getMapFromMaps (m, "main", "cookiePrefix"); … … 1456 1412 sprintf (tmp, "%s=", testing->value); 1457 1413 } 1458 if (strstr (cgi Cookie, ";") != NULL)1414 if (strstr (cgi->cgiCookie, ";") != NULL) 1459 1415 { 1460 1416 char *token, *saveptr; 1461 token = strtok_r (cgi Cookie, ";", &saveptr);1417 token = strtok_r (cgi->cgiCookie, ";", &saveptr); 1462 1418 while (token != NULL) 1463 1419 { … … 1474 1430 else 1475 1431 { 1476 if (strstr (cgi Cookie, "=") != NULL1477 && strcasestr (cgi Cookie, tmp) != NULL)1432 if (strstr (cgi->cgiCookie, "=") != NULL 1433 && strcasestr (cgi->cgiCookie, tmp) != NULL) 1478 1434 { 1479 tcook = zStrdup (cgi Cookie);1435 tcook = zStrdup (cgi->cgiCookie); 1480 1436 hasValidCookie = 1; 1481 1437 } … … 1498 1454 else 1499 1455 sprintf (session_file_path, "%s/sess_%s.cfg", tmpPath->value, 1500 strstr (cgi Cookie, "=") + 1);1456 strstr (cgi->cgiCookie, "=") + 1); 1501 1457 free (tcook); 1502 1458 maps *tmpSess = (maps *) malloc (MAPS_SIZE); … … 1539 1495 } 1540 1496 #endif 1497 1541 1498 char *fbkp, *fbkpid, *fbkpres, *fbkp1, *flog; 1542 1499 FILE *f0, *f1; … … 1546 1503 if (status == NULLMAP) 1547 1504 { 1548 if(validateRequest(&m,s1,request_inputs, &request_input_real_format,&request_output_real_format,&hInternet)<0){ 1549 free (s1); 1505 if(validateRequest(&m,s1,request_inputs, &request_input_real_format,&request_output_real_format,&hInternet,cgi)<0){ 1550 1506 freeMaps (&m); 1551 1507 free (m); … … 1560 1516 return -1; 1561 1517 } 1562 1518 fflush(stderr); 1563 1519 loadServiceAndRun (&m, s1, request_inputs, &request_input_real_format, 1564 &request_output_real_format, &eres); 1565 } 1566 else 1567 { 1520 &request_output_real_format, &eres,request->out,request->err); 1521 } 1522 else 1523 { 1524 1525 eres = SERVICE_ACCEPTED; 1526 vid = 1; 1527 1528 #ifdef AMQP 1529 1530 1531 eres = SERVICE_ACCEPTED; 1532 json_object *msg_jobj = json_object_new_object(); 1533 json_object *maps_obj; 1534 mapstojson(&maps_obj,m); 1535 json_object_object_add(msg_jobj,"maps",maps_obj); 1536 1537 1538 json_object *req_format_jobj; 1539 mapstojson(&req_format_jobj,request_input_real_format); 1540 json_object_object_add(msg_jobj,"request_input_real_format",req_format_jobj); 1541 1542 json_object *req_jobj; 1543 maptojson(&req_jobj,request_inputs); 1544 json_object_object_add(msg_jobj,"request_inputs",req_jobj); 1545 1546 1547 dumpMaps(request_output_real_format); 1548 json_object *outputs_jobj; 1549 mapstojson(&outputs_jobj,request_output_real_format); 1550 json_object_object_add(msg_jobj,"request_output_real_format",outputs_jobj); 1551 1552 bind_amqp(); 1553 1554 if ( (send_msg(json_object_to_json_string(msg_jobj),"application/json") != 0) ){ 1555 eres = SERVICE_FAILED; 1556 } 1557 close_amqp(); 1558 json_object_put(msg_jobj); 1559 1560 init_sql(m); 1561 recordServiceStatus(m); 1562 1563 1564 1565 1566 #else 1568 1567 int pid; 1569 1568 #ifdef DEBUG … … 1687 1686 printProcessResponse (m, request_inputs, cpid, s1, r_inputs1->value, 1688 1687 SERVICE_STARTED, request_input_real_format, 1689 request_output_real_format );1690 fflush (stdout); 1688 request_output_real_format,request->out); 1689 1691 1690 #ifdef RELY_ON_DB 1692 1691 recordResponse(m,fbkp); … … 1705 1704 f1 = freopen (fbkp1, "w+", stdout); 1706 1705 1707 if(validateRequest(&m,s1,request_inputs, &request_input_real_format,&request_output_real_format,&hInternet)<0){ 1708 //freeService (&s1); 1709 free (s1); 1706 if(validateRequest(&m,s1,request_inputs, &request_input_real_format,&request_output_real_format,&hInternet,cgi)<0){ 1710 1707 freeMaps (&m); 1711 1708 free (m); … … 1718 1715 freeMaps (&tmpmaps); 1719 1716 free (tmpmaps); 1720 fflush (stdout);1721 1717 fflush (stderr); 1722 1718 unhandleStatus (m); 1723 1719 return -1; 1724 1720 } 1721 1725 1722 loadServiceAndRun (&m, s1, request_inputs, 1726 1723 &request_input_real_format, 1727 &request_output_real_format, &eres );1724 &request_output_real_format, &eres,request->out,request->err); 1728 1725 1729 1726 } … … 1736 1733 eres = -1; 1737 1734 errorException (m, _("Unable to run the child process properly"), 1738 "InternalError", NULL );1735 "InternalError", NULL,request->out); 1739 1736 } 1740 } 1737 1738 #endif 1739 1740 } 1741 1742 1743 1741 1744 1742 1745 #ifdef DEBUG … … 1746 1749 outputResponse (s1, request_input_real_format, 1747 1750 request_output_real_format, request_inputs, 1748 cpid, m, eres );1749 fflush (stdout);1751 cpid, m, eres,request->out); 1752 //fflush (stdout); 1750 1753 1754 1751 1755 /** 1752 1756 * Ensure that if error occurs when freeing memory, no signal will return … … 1819 1823 free (tmps1); 1820 1824 } 1821 1822 //freeService (&s1);1823 free (s1);1824 1825 freeMaps (&m); 1825 1826 free (m); -
branches/PublicaMundi_David_integration_01-devel/zoo-project/zoo-kernel/zoo_zcfg.c
r678 r741 269 269 #ifdef DEBUG 270 270 dumpService (s1); 271 fflush (stdout);272 271 fflush (stderr); 273 272 #endif
Note: See TracChangeset
for help on using the changeset viewer.