- Timestamp:
- Jun 27, 2014, 1:14:39 AM (10 years ago)
- Location:
- trunk/zoo-project/zoo-kernel
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/Makefile.in
r489 r490 92 92 g++ -g -O2 ${XML2CFLAGS} ${CFLAGS} ${PYTHONCFLAGS} ${JAVACFLAGS} ${JSCFLAGS} ${PERLCFLAGS} ${PHPCFLAGS} ${PYTHON_ENABLED} ${JS_ENABLED} ${PHP_ENABLED} ${PERL_ENABLED} ${JAVA_ENABLED} -c zoo_service_loader.c -fno-common -DPIC -o zoo_service_loader.o 93 93 94 zoo_loader.cgi: zoo_loader.c zoo_service_loader.o ulinet.o service.h lex.sr.o service_conf.tab.o service_conf.y ulinet.o main_conf_read.tab.o lex.cr.o service_internal.o ${MS_FILE} ${PYTHON_FILE} ${PHP_FILE} ${JAVA_FILE} ${JS_FILE} ${PERL_FILE} ${RUBY_FILE} ${YAML_FILE}94 zoo_loader.cgi: version.h zoo_loader.c zoo_service_loader.o ulinet.o service.h lex.sr.o service_conf.tab.o service_conf.y ulinet.o main_conf_read.tab.o lex.cr.o service_internal.o ${MS_FILE} ${PYTHON_FILE} ${PHP_FILE} ${JAVA_FILE} ${JS_FILE} ${PERL_FILE} ${RUBY_FILE} ${YAML_FILE} 95 95 g++ -g -O2 ${JSCFLAGS} ${PHPCFLAGS} ${PERLCFLAGS} ${RUBYCFLAGS} ${JAVACFLAGS} ${XML2CFLAGS} ${PYTHONCFLAGS} ${CFLAGS} -c zoo_loader.c -fno-common -DPIC -o zoo_loader.o 96 96 g++ ${JSCFLAGS} ${GDAL_CFLAGS} ${XML2CFLAGS} ${PHPCFLAGS} ${PERLCFLAGS} ${JAVACFLAGS} ${PYTHONCFLAGS} ${CFLAGS} zoo_loader.o zoo_service_loader.o service_internal.o ${MS_FILE} ${PYTHON_FILE} ${PERL_FILE} ${PHP_FILE} ${JS_FILE} ${JAVA_FILE} ${YAML_FILE} ulinet.o lex.cr.o lex.sr.o service_conf.tab.o main_conf_read.tab.o -o zoo_loader.cgi ${LDFLAGS} -
trunk/zoo-project/zoo-kernel/main_conf_read.y
r465 r490 13 13 static char* curr_key; 14 14 static int debug=0; 15 using namespace std;16 15 17 16 extern void crerror(const char *s); -
trunk/zoo-project/zoo-kernel/service.h
r474 r490 61 61 #include <string.h> 62 62 #ifndef WIN32 63 #ifndef bool 63 64 #define bool int 65 #endif 66 #ifndef true 64 67 #define true 1 65 68 #define false -1 69 #endif 66 70 #else 67 71 //#include <stdbool.h> … … 422 426 if(hasKey(m,n)==false){ 423 427 map* _cursor=m; 424 if(_cursor->next!=NULL){425 addToMap(_cursor->next,n,v);426 } else427 428 while(_cursor->next!=NULL){ 429 _cursor=_cursor->next; 430 } 431 _cursor->next=createMap(n,v); 428 432 } 429 433 else{ … … 478 482 } 479 483 480 static map* getMapOrFill(map** m,const char *key,c har* value){484 static map* getMapOrFill(map** m,const char *key,const char* value){ 481 485 map* tmp=*m; 482 486 map* tmpMap=getMap(tmp,key); 483 487 if(tmpMap==NULL){ 484 if(tmp!=NULL) 485 addToMap(*m,key,value); 488 if(tmp!=NULL){ 489 addToMap((*m),key,value); 490 } 486 491 else 487 492 (*m)=createMap(key,value); … … 580 585 } 581 586 582 static map* getMapArray(map* m,c har* key,int index){587 static map* getMapArray(map* m,const char* key,int index){ 583 588 char tmp[1024]; 584 589 if(index>0) … … 659 664 addToMap(_cursor->content,"length",tmpLen); 660 665 int i=0; 661 map* tmpSizeI=getMap(tmp->content,tmpV[i]);662 666 for(i=0;i<8;i++){ 663 667 map* tmpVI=getMap(tmp->content,tmpV[i]); … … 887 891 888 892 static void dumpServiceAsYAML(service* s){ 889 int level=0;890 893 int i; 891 894 fprintf(stderr,"# %s\n\n",s->name); … … 905 908 } 906 909 if(s->inputs!=NULL){ 907 fprintf(stderr,"\ninputs:\n" ,s->name);910 fprintf(stderr,"\ninputs:\n"); 908 911 dumpElementsAsYAML(s->inputs); 909 912 } 910 913 if(s->outputs!=NULL){ 911 fprintf(stderr,"\noutputs:\n" ,s->name);914 fprintf(stderr,"\noutputs:\n"); 912 915 dumpElementsAsYAML(s->outputs); 913 916 } -
trunk/zoo-project/zoo-kernel/service_internal.c
r485 r490 181 181 182 182 void unhandleStatus(maps *conf){ 183 int shmid ,i;183 int shmid; 184 184 key_t key; 185 185 void *shm; 186 186 struct shmid_ds shmids; 187 char *s,*s1;188 187 map *tmpMap=getMapFromMaps(conf,"lenv","sid"); 189 188 if(tmpMap!=NULL){ … … 207 206 208 207 int _updateStatus(maps *conf){ 209 int shmid ,i;208 int shmid; 210 209 key_t key; 211 210 char *shm,*s,*s1; … … 247 246 248 247 char* getStatus(int pid){ 249 int shmid ,i;248 int shmid; 250 249 key_t key; 251 250 void *shm; 252 char *s;253 251 key=pid; 254 252 if ((shmid = shmget(key, SHMSZ, 0666)) < 0) { … … 265 263 } 266 264 } 267 return "-1";265 return (char*)"-1"; 268 266 } 269 267 … … 277 275 jsval *argv = JS_ARGV(cx,argv1); 278 276 JS_MaybeGC(cx); 279 char *sid;280 277 int istatus=0; 281 278 char *status=NULL; 282 279 maps *conf; 283 int i=0;284 280 if(argc>2){ 285 281 #ifdef JS_DEBUG … … 385 381 #endif 386 382 int currId=-1; 387 int currNode=-1;388 383 if(nbNs==0){ 389 384 nbNs++; … … 419 414 nbNs=0; 420 415 } 416 417 418 int zooXmlAddDoc(const char* value){ 419 int currId=0; 420 nbDocs++; 421 currId=nbDocs-1; 422 iDocs[currId]=xmlParseMemory(value,strlen(value)); 423 return currId; 424 } 425 426 void zooXmlCleanupDocs(){ 427 int j; 428 for(j=nbDocs-1;j>=0;j--){ 429 xmlFreeDoc(iDocs[j]); 430 } 431 nbDocs=0; 432 } 433 421 434 422 435 xmlNodePtr soapEnvelope(maps* conf,xmlNodePtr n){ … … 447 460 448 461 xmlNsPtr ns,ns_ows,ns_xlink,ns_xsi; 449 xmlNodePtr n,nc,nc1,nc2,nc3,nc4,nc5,nc6,pseudor; 450 xmlChar *xmlbuff; 451 int buffersize; 462 xmlNodePtr n,nc,nc1,nc2,nc3,nc4,nc5,nc6; 452 463 /** 453 464 * Create the document and its temporary root. … … 486 497 if(tmp4!=NULL){ 487 498 map* tmp2=tmp4->content; 488 c har *orderedFields[5];499 const char *orderedFields[5]; 489 500 orderedFields[0]="Title"; 490 501 orderedFields[1]="Abstract"; … … 555 566 if(tmp4!=NULL){ 556 567 map* tmp2=tmp4->content; 557 c har *tmpAddress[6];568 const char *tmpAddress[6]; 558 569 tmpAddress[0]="addressDeliveryPoint"; 559 570 tmpAddress[1]="addressCity"; … … 562 573 tmpAddress[4]="addressCountry"; 563 574 tmpAddress[5]="addressElectronicMailAddress"; 564 c har *tmpPhone[2];575 const char *tmpPhone[2]; 565 576 tmpPhone[0]="phoneVoice"; 566 577 tmpPhone[1]="phoneFacsimile"; 567 c har *orderedFields[12];578 const char *orderedFields[12]; 568 579 orderedFields[0]="providerName"; 569 580 orderedFields[1]="providerSite"; … … 608 619 for(j=0;j<2;j++) 609 620 if(strcasecmp(tmp2->name,tmpPhone[j])==0){ 610 char *toto=NULL; 611 char *toto1=tmp2->name; 612 toto=strstr(toto1,"Phone"); 613 nc1 = xmlNewNode(ns_ows, BAD_CAST toto1+5); 621 char *tmp4=tmp2->name; 622 nc1 = xmlNewNode(ns_ows, BAD_CAST tmp4+5); 614 623 xmlAddChild(nc1,xmlNewText(BAD_CAST tmp2->value)); 615 624 xmlAddChild(nc5,nc1); … … 621 630 for(j=0;j<6;j++) 622 631 if(strcasecmp(tmp2->name,tmpAddress[j])==0){ 623 char *toto=NULL; 624 char *toto1=tmp2->name; 625 toto=strstr(toto1,"Address"); 626 nc1 = xmlNewNode(ns_ows, BAD_CAST toto1+7); 632 char *tmp4=tmp2->name; 633 nc1 = xmlNewNode(ns_ows, BAD_CAST tmp4+7); 627 634 xmlAddChild(nc1,xmlNewText(BAD_CAST tmp2->value)); 628 635 xmlAddChild(nc6,nc1); … … 799 806 void printGetCapabilitiesForProcess(maps* m,xmlNodePtr nc,service* serv){ 800 807 xmlNsPtr ns,ns_ows,ns_xlink; 801 xmlNodePtr n r,n,nc1,nc2,nc3,nc4,nc5,nc6,pseudor;808 xmlNodePtr n=NULL,nc1,nc2; 802 809 /** 803 810 * Initialize or get existing namspaces … … 810 817 ns_xlink=usedNs[xlinkId]; 811 818 812 int cursor=0;813 819 map* tmp1; 814 820 if(serv->content!=NULL){ … … 833 839 xmlNodePtr printDescribeProcessHeader(xmlDocPtr doc,const char* service,maps* m){ 834 840 835 xmlNsPtr ns,ns_ows,ns_xlink,ns_xsi; 836 xmlNodePtr n,nr; 837 xmlChar *xmlbuff; 838 int buffersize; 841 xmlNsPtr ns,ns_xsi; 842 xmlNodePtr n; 839 843 840 844 int wpsId=zooXmlAddNs(NULL,"http://schemas.opengis.net/wps/1.0.0","wps"); 841 845 ns=usedNs[wpsId]; 842 846 n = xmlNewNode(ns, BAD_CAST "ProcessDescriptions"); 843 int owsId=zooXmlAddNs(n,"http://www.opengis.net/ows/1.1","ows"); 844 ns_ows=usedNs[owsId]; 847 zooXmlAddNs(n,"http://www.opengis.net/ows/1.1","ows"); 845 848 xmlNewNs(n,BAD_CAST "http://www.opengis.net/wps/1.0.0",BAD_CAST "wps"); 846 849 zooXmlAddNs(n,"http://www.w3.org/1999/xlink","xlink"); … … 860 863 861 864 void printDescribeProcessForProcess(maps* m,xmlNodePtr nc,service* serv){ 862 xmlNsPtr ns,ns_ows,ns_xlink,ns_xsi; 863 xmlNodePtr nr,n,nc1,nc2,nc3,nc4,nc5,nc6,pseudor; 864 865 char tmp[256]; 865 xmlNsPtr ns,ns_ows,ns_xlink; 866 xmlNodePtr n,nc1; 867 866 868 n=nc; 867 869 … … 874 876 875 877 nc = xmlNewNode(NULL, BAD_CAST "ProcessDescription"); 876 c har *tmp4[3];878 const char *tmp4[3]; 877 879 tmp4[0]="processVersion"; 878 880 tmp4[1]="storeSupported"; … … 916 918 nc1 = xmlNewNode(NULL, BAD_CAST "DataInputs"); 917 919 elements* e=serv->inputs; 918 printFullDescription( e,"Input",ns_ows,nc1);920 printFullDescription(1,e,"Input",ns_ows,nc1); 919 921 xmlAddChild(nc,nc1); 920 922 } … … 922 924 nc1 = xmlNewNode(NULL, BAD_CAST "ProcessOutputs"); 923 925 elements* e=serv->outputs; 924 printFullDescription( e,"Output",ns_ows,nc1);926 printFullDescription(0,e,"Output",ns_ows,nc1); 925 927 xmlAddChild(nc,nc1); 926 928 … … 929 931 } 930 932 931 void printFullDescription( elements *elem,const char* type,xmlNsPtr ns_ows,xmlNodePtr nc1){932 c har *orderedFields[13];933 void printFullDescription(int in,elements *elem,const char* type,xmlNsPtr ns_ows,xmlNodePtr nc1){ 934 const char *orderedFields[13]; 933 935 orderedFields[0]="mimeType"; 934 936 orderedFields[1]="encoding"; … … 1001 1003 iotype* _tmp=e->defaults; 1002 1004 int datatype=0; 1003 bool hasDefault=false;1004 1005 bool hasUOM=false; 1005 1006 bool hasUOM1=false; … … 1079 1080 * RangeClosure: Table 47 OGC Web Services Common Standard 1080 1081 */ 1081 c har *tmp="closed";1082 const char *tmp="closed"; 1082 1083 if(orig[0]=='[' && orig[strlen(orig)-1]=='[') 1083 1084 tmp="closed-open"; … … 1146 1147 tmp0=getMap(tmp1,"rangeClosure"); 1147 1148 if(tmp0!=NULL){ 1148 c har *tmp="closed";1149 const char *tmp="closed"; 1149 1150 if(strcasecmp(tmp0->value,"co")==0) 1150 1151 tmp="closed-open"; … … 1190 1191 1191 1192 1192 int avcnt=0;1193 int dcnt=0;1194 1193 int oI=0; 1195 1194 for(oI=0;oI<13;oI++) … … 1247 1246 1248 1247 map* metadata=e->metadata; 1249 xmlNodePtr n ;1248 xmlNodePtr n=NULL; 1250 1249 int xlinkId=zooXmlAddNs(n,"http://www.w3.org/1999/xlink","xlink"); 1251 1250 xmlNsPtr ns_xlink=usedNs[xlinkId]; … … 1353 1352 } 1354 1353 1355 if( datatype==1 &&1354 if(in>0 && datatype==1 && 1356 1355 getMap(_tmp->content,"AllowedValues")==NULL && 1357 1356 getMap(_tmp->content,"range")==NULL && … … 1389 1388 1390 1389 void printProcessResponse(maps* m,map* request, int pid,service* serv,const char* service,int status,maps* inputs,maps* outputs){ 1391 xmlNsPtr ns,ns 1,ns_ows,ns_xlink,ns_xsi;1392 xmlNodePtr nr,n,nc,nc1 ,nc2,nc3,pseudor;1390 xmlNsPtr ns,ns_ows,ns_xlink,ns_xsi; 1391 xmlNodePtr nr,n,nc,nc1=NULL,nc3; 1393 1392 xmlDocPtr doc; 1394 xmlChar *xmlbuff;1395 int buffersize;1396 1393 time_t time1; 1397 1394 time(&time1); … … 1574 1571 if(lineage!=NULL && strcasecmp(lineage->value,"true")==0){ 1575 1572 nc = xmlNewNode(ns, BAD_CAST "DataInputs"); 1576 int i;1577 1573 maps* mcursor=inputs; 1578 1574 elements* scursor=NULL; … … 1727 1723 1728 1724 void printOutputDefinitions(xmlDocPtr doc,xmlNodePtr nc,xmlNsPtr ns_wps,xmlNsPtr ns_ows,elements* e,map* m,const char* type){ 1729 xmlNodePtr nc1 ,nc2,nc3;1725 xmlNodePtr nc1; 1730 1726 nc1=xmlNewNode(ns_wps, BAD_CAST type); 1731 1727 map *tmp=NULL; … … 1774 1770 xmlAddChild(nc1,nc2); 1775 1771 xmlAddChild(nc,nc1); 1776 // Extract Title required to be first element in the ZCFG file !1777 bool isTitle=TRUE;1778 1772 if(e!=NULL) 1779 1773 tmp=getMap(e->content,"Title"); … … 1836 1830 strcasecmp(tmp->name,"schema")==0 || 1837 1831 strcasecmp(tmp->name,"datatype")==0 || 1838 strcasecmp(tmp->name,"uom")==0) 1832 strcasecmp(tmp->name,"uom")==0){ 1839 1833 #ifdef USE_MS 1840 1834 if(testMap==NULL || (testMap!=NULL && strncasecmp(testMap->value,"text/xml",8)==0)){ 1841 1835 #endif 1842 xmlNewProp(nc3,BAD_CAST tmp->name,BAD_CAST tmp->value);1836 xmlNewProp(nc3,BAD_CAST tmp->name,BAD_CAST tmp->value); 1843 1837 #ifdef USE_MS 1844 1838 } 1845 else 1846 if(strcasecmp(tmp->name,"mimeType")==0) 1847 if(testMap!=NULL) 1848 xmlNewProp(nc3,BAD_CAST tmp->name,BAD_CAST testMap->value); 1849 else 1850 xmlNewProp(nc3,BAD_CAST tmp->name,BAD_CAST tmp->value); 1851 #endif 1839 else 1840 if(strcasecmp(tmp->name,"mimeType")==0){ 1841 if(testMap!=NULL) 1842 xmlNewProp(nc3,BAD_CAST tmp->name,BAD_CAST testMap->value); 1843 else 1844 xmlNewProp(nc3,BAD_CAST tmp->name,BAD_CAST tmp->value); 1845 } 1846 #endif 1847 } 1852 1848 tmp=tmp->next; 1853 1849 xmlAddChild(nc2,nc3); … … 1897 1893 if((tmp1!=NULL && strncmp(tmp1->value,"base64",6)==0) 1898 1894 || (tmp2!=NULL && (strncmp(tmp2->value,"image/",6)==0 || 1899 (strncmp(tmp2->value,"application/",12)==0 )&&1900 strncmp(tmp2->value,"application/json",16)!=0&&1901 strncmp(tmp2->value,"application/x-javascript",24)!=0&&1902 strncmp(tmp2->value,"application/vnd.google-earth.kml",32)!=0)1895 (strncmp(tmp2->value,"application/",12)==0 && 1896 strncmp(tmp2->value,"application/json",16)!=0&& 1897 strncmp(tmp2->value,"application/x-javascript",24)!=0&& 1898 strncmp(tmp2->value,"application/vnd.google-earth.kml",32)!=0)) 1903 1899 )) { 1904 1900 map* rs=getMap(m->content,"size"); … … 1906 1902 if(rs==NULL){ 1907 1903 char tmp1[1024]; 1908 sprintf(tmp1,"% d",strlen(tmp3->value));1904 sprintf(tmp1,"%u",strlen(tmp3->value)); 1909 1905 rs=createMap("size",tmp1); 1910 1906 isSized=false; … … 1924 1920 if(strncmp(tmp2->value,"text/xml",8)==0 || 1925 1921 strncmp(tmp2->value,"application/vnd.google-earth.kml",32)==0){ 1926 xmlDocPtr doc =1927 xmlParseMemory(tmp3->value,strlen(tmp3->value));1922 int li=zooXmlAddDoc(tmp3->value); 1923 xmlDocPtr doc = iDocs[li]; 1928 1924 xmlNodePtr ir = xmlDocGetRootElement(doc); 1929 1925 xmlAddChild(nc3,ir); … … 1959 1955 strcasecmp(tmp->name,"schema")==0 || 1960 1956 strcasecmp(tmp->name,"datatype")==0 || 1961 strcasecmp(tmp->name,"uom")==0) 1957 strcasecmp(tmp->name,"uom")==0){ 1962 1958 #ifdef USE_MS 1963 1959 if(testMap!=NULL && strncasecmp(testMap->value,"text/xml",8)!=0){ … … 1967 1963 else 1968 1964 #endif 1969 xmlNewProp(nc3,BAD_CAST tmp->name,BAD_CAST tmp->value); 1965 xmlNewProp(nc3,BAD_CAST tmp->name,BAD_CAST tmp->value); 1966 } 1970 1967 tmp=tmp->next; 1971 1968 xmlAddChild(nc2,nc3); … … 1983 1980 xmlAddChild(root,nc2); 1984 1981 map* tmp=amap; 1985 c har *tmp2[2];1982 const char *tmp2[2]; 1986 1983 tmp2[0]="Title"; 1987 1984 tmp2[1]="Abstract"; … … 2004 2001 } 2005 2002 else 2006 return "UTF-8";2003 return (char*)"UTF-8"; 2007 2004 } 2008 2005 else 2009 return "UTF-8";2006 return (char*)"UTF-8"; 2010 2007 } 2011 2008 … … 2017 2014 } 2018 2015 else 2019 return "1.0.0";2016 return (char*)"1.0.0"; 2020 2017 } 2021 2018 else 2022 return "1.0.0";2019 return (char*)"1.0.0"; 2023 2020 } 2024 2021 … … 2035 2032 maps* tmpMap=getMaps(m,"main"); 2036 2033 char *encoding=getEncoding(tmpMap); 2037 c har *exceptionCode;2034 const char *exceptionCode; 2038 2035 2039 2036 map* tmp=getMap(s,"code"); … … 2087 2084 xmlNodePtr createExceptionReportNode(maps* m,map* s,int use_ns){ 2088 2085 2089 int buffersize; 2090 xmlChar *xmlbuff; 2091 xmlNsPtr ns,ns_ows,ns_xlink,ns_xsi; 2092 xmlNodePtr n,nc,nc1,nc2; 2093 2094 maps* tmpMap=getMaps(m,"main"); 2086 xmlNsPtr ns,ns_xsi; 2087 xmlNodePtr n,nc,nc1; 2095 2088 2096 2089 int nsid=zooXmlAddNs(NULL,"http://www.opengis.net/ows","ows"); … … 2101 2094 n = xmlNewNode(ns, BAD_CAST "ExceptionReport"); 2102 2095 if(use_ns==1){ 2103 ns_ows=xmlNewNs(n,BAD_CAST "http://www.opengis.net/ows/1.1",NULL);2096 xmlNewNs(n,BAD_CAST "http://www.opengis.net/ows/1.1",NULL); 2104 2097 int xsiId=zooXmlAddNs(n,"http://www.w3.org/2001/XMLSchema-instance","xsi"); 2105 2098 ns_xsi=usedNs[xsiId]; … … 2126 2119 tmp=getMap(s,"text"); 2127 2120 nc1 = xmlNewNode(ns, BAD_CAST "ExceptionText"); 2128 nc2=NULL;2129 2121 if(tmp!=NULL){ 2130 2122 xmlNodeSetContent(nc1, BAD_CAST tmp->value); … … 2154 2146 if(tmpSess!=NULL){ 2155 2147 map *_tmp=getMapFromMaps(m,"lenv","cookie"); 2156 char* sessId ;2148 char* sessId=NULL; 2157 2149 if(_tmp!=NULL){ 2158 2150 printf("Set-Cookie: %s; HttpOnly\r\n",_tmp->value); … … 2493 2485 if(type==0){ 2494 2486 map* tmpMapMinO=getMap(tmpInputs->content,"minOccurs"); 2495 if(tmpMapMinO!=NULL) 2487 if(tmpMapMinO!=NULL){ 2496 2488 if(atoi(tmpMapMinO->value)>=1){ 2497 2489 freeMaps(&tmpMaps2); … … 2505 2497 addToMap(tmpMaps2->content,"minOccurs",tmpMapMinO->value); 2506 2498 } 2499 } 2507 2500 map* tmpMaxO=getMap(tmpInputs->content,"maxOccurs"); 2508 if(tmpMaxO!=NULL) 2501 if(tmpMaxO!=NULL){ 2509 2502 if(tmpMaps2->content==NULL) 2510 2503 tmpMaps2->content=createMap("maxOccurs",tmpMaxO->value); 2511 2504 else 2512 2505 addToMap(tmpMaps2->content,"maxOccurs",tmpMaxO->value); 2506 } 2513 2507 map* tmpMaxMB=getMap(tmpInputs->content,"maximumMegabytes"); 2514 if(tmpMaxMB!=NULL) 2508 if(tmpMaxMB!=NULL){ 2515 2509 if(tmpMaps2->content==NULL) 2516 2510 tmpMaps2->content=createMap("maximumMegabytes",tmpMaxMB->value); 2517 2511 else 2518 2512 addToMap(tmpMaps2->content,"maximumMegabytes",tmpMaxMB->value); 2513 } 2519 2514 } 2520 2515 … … 2572 2567 } 2573 2568 map* tmpMaxMB=getMap(tmpInputs->content,"maximumMegabytes"); 2574 if(tmpMaxMB!=NULL) 2569 if(tmpMaxMB!=NULL){ 2575 2570 if(tmpMaps->content==NULL) 2576 2571 tmpMaps->content=createMap("maximumMegabytes",tmpMaxMB->value); 2577 2572 else 2578 2573 addToMap(tmpMaps->content,"maximumMegabytes",tmpMaxMB->value); 2574 } 2579 2575 /** 2580 2576 * Parsing BoundingBoxData, fill the following map and then add it to … … 2746 2742 void printBoundingBox(xmlNsPtr ns_ows,xmlNodePtr n,map* boundingbox){ 2747 2743 2748 xmlNodePtr bb,lw,uc;2744 xmlNodePtr lw=NULL,uc=NULL; 2749 2745 2750 2746 map* tmp=getMap(boundingbox,"value"); … … 2876 2872 fprintf(stderr,"MIMETYPE: %s\n",mimeType); 2877 2873 #endif 2878 fwrite(mimeType, sizeof(char),strlen(mimeType),fo);2874 fwrite(mimeType,1,strlen(mimeType),fo); 2879 2875 fclose(fo); 2880 2876 … … 2914 2910 char* cached=isInCache(*m,url); 2915 2911 char *mimeType=NULL; 2916 int fsize; 2917 int hasF=-1; 2912 int fsize=0; 2918 2913 if(cached!=NULL){ 2919 2914 struct stat f_status; … … 2922 2917 fcontent=(char*)malloc(sizeof(char)*(f_status.st_size+1)); 2923 2918 FILE* f=fopen(cached,"rb"); 2924 int len=fread(fcontent,f_status.st_size,1,f);2919 fread(fcontent,f_status.st_size,1,f); 2925 2920 fsize=f_status.st_size; 2926 2921 fcontent[fsize]=0; … … 2932 2927 mimeType=(char*)malloc(sizeof(char)*(f_status.st_size+1)); 2933 2928 FILE* f=fopen(cached,"rb"); 2934 int len=fread(mimeType,f_status.st_size,1,f);2929 fread(mimeType,f_status.st_size,1,f); 2935 2930 mimeType[f_status.st_size]=0; 2936 2931 fclose(f); … … 2970 2965 if(cached==NULL) 2971 2966 addToCache(*m,url,fcontent,mimeType,fsize); 2972 else{ 2973 free(fcontent); 2974 free(mimeType); 2975 free(cached); 2976 } 2967 free(fcontent); 2968 free(mimeType); 2969 free(cached); 2977 2970 return 0; 2978 2971 } … … 2992 2985 } 2993 2986 2987 2994 2988 char *readVSIFile(maps* conf,const char* dataSource){ 2995 2989 VSILFILE * fichier=VSIFOpenL(dataSource,"rb"); … … 3004 2998 } 3005 2999 char *res1=(char *)malloc(file_status.st_size*sizeof(char)); 3006 VSIFReadL(res1,1,(file_status.st_size)*sizeof(char),fichier); 3000 VSIFReadL(res1,1,file_status.st_size*sizeof(char),fichier); 3001 res1[file_status.st_size-1]=0; 3007 3002 VSIFCloseL(fichier); 3008 3003 VSIUnlink(dataSource); … … 3065 3060 } 3066 3061 3067 3068 3062 int updateStatus( maps* conf, const int percentCompleted, const char* message ){ 3069 3063 char tmp[4]; … … 3098 3092 tmp->value=(char*) malloc((numberOfBytes+1)*sizeof(char)); 3099 3093 memcpy(tmp->value,data,numberOfBytes); 3100 sprintf(size,"% d",numberOfBytes);3094 sprintf(size,"%lu",numberOfBytes); 3101 3095 setMapInMaps(outputs,parameterName,"size",size); 3102 3096 } -
trunk/zoo-project/zoo-kernel/service_internal.h
r478 r490 57 57 #endif 58 58 #include <dirent.h> 59 #include "ulinet.h" 60 59 61 #include "service.h" 60 62 #include <openssl/sha.h> … … 64 66 #include <openssl/bio.h> 65 67 #include <openssl/buffer.h> 66 67 #include "ulinet.h"68 68 69 69 extern int conf_read(const char*,maps*); … … 88 88 static xmlNsPtr usedNs[10]; 89 89 static char* nsName[10]; 90 static xmlDocPtr iDocs[10]; 90 91 static int nbNs=0; 92 static int nbDocs=0; 91 93 92 94 int getServiceFromYAML(maps*,char*,service**,char *name); … … 112 114 int zooXmlAddNs(xmlNodePtr,const char*,const char*); 113 115 void zooXmlCleanupNs(); 116 117 int zooXmlAddDoc(xmlNodePtr,const char*,const char*); 118 void zooXmlCleanupDocs(); 114 119 115 120 void printExceptionReportResponse(maps*,map*); … … 120 125 xmlNodePtr printDescribeProcessHeader(xmlDocPtr,const char*,maps*); 121 126 void printDescribeProcessForProcess(maps*,xmlNodePtr,service*); 122 void printFullDescription( elements*,const char*,xmlNsPtr,xmlNodePtr);127 void printFullDescription(int,elements*,const char*,xmlNsPtr,xmlNodePtr); 123 128 void printDocument(maps*,xmlDocPtr,int); 124 129 void printDescription(xmlNodePtr,xmlNsPtr,const char*,map*); -
trunk/zoo-project/zoo-kernel/service_internal_ms.c
r475 r490 129 129 if(strncasecmp(rformat->value,"image/tiff",10)==0) 130 130 proto=2; 131 if(protoMap!=NULL) 131 if(protoMap!=NULL){ 132 132 if(strncasecmp(protoMap->value,"WMS",3)==0) 133 133 proto=0; 134 else if(strncasecmp(protoMap->value,"WFS",3)==0) 135 proto=1; 136 else 137 proto=2; 138 134 else{ 135 if(strncasecmp(protoMap->value,"WFS",3)==0) 136 proto=1; 137 else 138 proto=2; 139 } 140 } 139 141 char *protoVersion=options[proto][1]; 140 142 if(proto==1){ … … 278 280 msLoadProjectionStringEPSG(&myLayer->projection,msSrs->value); 279 281 char tmpSrs[128]; 280 sprintf(tmpSrs,"%s EPSG:4326 EPSG:900913",msSrs );282 sprintf(tmpSrs,"%s EPSG:4326 EPSG:900913",msSrs->value); 281 283 msInsertHashTable(&(m->web.metadata),"ows_srs",tmpSrs); 282 284 msInsertHashTable(&(myLayer->metadata),"ows_srs",tmpSrs); … … 574 576 msInsertHashTable(&(myLayer->metadata), "ows_srs", "EPSG:4326 EPSG:900913"); 575 577 } 576 577 map* crs=getMap(output->content,"crs");578 map* isGeo=getMap(output->content,"crs_isGeographic");579 578 580 579 OGREnvelope oExt; -
trunk/zoo-project/zoo-kernel/service_internal_python.c
r478 r490 107 107 Py_DECREF(tmp); 108 108 109 ZooError = PyErr_NewException( "zoo.error", NULL, NULL);109 ZooError = PyErr_NewException((char*)"zoo.error", NULL, NULL); 110 110 Py_INCREF(ZooError); 111 111 PyModule_AddObject(module, "error", ZooError); … … 138 138 } 139 139 else{ 140 python_path= ".";140 python_path=(char*)"."; 141 141 } 142 142 tmp=NULL; … … 243 243 if(PyString_Check(trace)){ 244 244 char *tpbt=zStrdup(pbt); 245 sprintf(pbt,"%s\n%s \0",tpbt,PyString_AsString(trace));245 sprintf(pbt,"%s\n%s",tpbt,PyString_AsString(trace)); 246 246 free(tpbt); 247 247 } … … 261 261 sprintf(pbt,"%s\nUnable to run your python process properly. Please check the following messages : %s",tpbt,PyString_AsString(trace)); 262 262 else 263 sprintf(pbt,"%s \n Unable to run your python process properly. Unable to provide any futher informations. %s",tpbt);263 sprintf(pbt,"%s \n Unable to run your python process properly. Unable to provide any futher informations.",tpbt); 264 264 free(tpbt); 265 265 map* err=createMap("text",pbt); … … 492 492 tmpR->value[size]=0; 493 493 char sin[1024]; 494 sprintf(sin,"% d",size);494 sprintf(sin,"%ld",size); 495 495 addToMap(res,"size",sin); 496 496 }else{ … … 546 546 /* now update the map */ 547 547 { 548 PyObject* lenv = PyMapping_GetItemString(confdict, "lenv");548 PyObject* lenv = PyMapping_GetItemString(confdict, (char *)"lenv"); 549 549 if (lenv && PyMapping_Check(lenv)){ 550 550 PyObject* valobj = PyString_FromString(status); 551 PyMapping_SetItemString(lenv, "status", valobj);551 PyMapping_SetItemString(lenv, (char *)"status", valobj); 552 552 Py_DECREF(valobj); 553 553 } -
trunk/zoo-project/zoo-kernel/service_yaml.c
r465 r490 144 144 case YAML_SCALAR_TOKEN: 145 145 if(ttype==0){ 146 cur_key=zStrdup( token.data.scalar.value);146 cur_key=zStrdup((char *)token.data.scalar.value); 147 147 } 148 148 if(ttype==1){ 149 149 if(current_content==NULL){ 150 current_content=createMap(cur_key, token.data.scalar.value);150 current_content=createMap(cur_key,(char *)token.data.scalar.value); 151 151 }else{ 152 addToMap(current_content,cur_key, token.data.scalar.value);152 addToMap(current_content,cur_key,(char *)token.data.scalar.value); 153 153 } 154 154 free(cur_key); … … 156 156 } 157 157 158 if(ttype==0 && blevel==0 && level==0 && strcasecmp( token.data.scalar.value,"MetaData")==0 && blevel==0){158 if(ttype==0 && blevel==0 && level==0 && strcasecmp((char *)token.data.scalar.value,"MetaData")==0 && blevel==0){ 159 159 addMapToMap(&my_service->content,current_content); 160 160 #ifdef DEBUG_YAML … … 166 166 wait_metadata=1; 167 167 } 168 if(ttype==0 && blevel>0 && level>0 && strcasecmp( token.data.scalar.value,"MetaData")==0){168 if(ttype==0 && blevel>0 && level>0 && strcasecmp((char *)token.data.scalar.value,"MetaData")==0){ 169 169 if(current_element->content==NULL && current_content!=NULL) 170 170 addMapToMap(¤t_element->content,current_content); … … 178 178 wait_metadata=1; 179 179 } 180 if(ttype==0 && strcasecmp( token.data.scalar.value,"inputs")==0 && blevel==0){180 if(ttype==0 && strcasecmp((char *)token.data.scalar.value,"inputs")==0 && blevel==0){ 181 181 if(wait_metadata>0){ 182 182 addMapToMap(&my_service->metadata,current_content); … … 196 196 level++; 197 197 } 198 if(ttype==0 && strcasecmp( token.data.scalar.value,"outputs")==0 && blevel==1){198 if(ttype==0 && strcasecmp((char *)token.data.scalar.value,"outputs")==0 && blevel==1){ 199 199 level++; 200 200 #ifdef DEBUG_YAML … … 229 229 } 230 230 } 231 if(level==1 && strcasecmp( token.data.scalar.value,"default")==0){231 if(level==1 && strcasecmp((char *)token.data.scalar.value,"default")==0){ 232 232 ilevel=0; 233 233 } 234 if(level==1 && strcasecmp( token.data.scalar.value,"supported")==0){234 if(level==1 && strcasecmp((char *)token.data.scalar.value,"supported")==0){ 235 235 #ifdef DEBUG_YAML 236 236 dumpMap(current_content); … … 271 271 272 272 273 if(strncasecmp(token.data.scalar.value,"ComplexData",11)==0 || strncasecmp(token.data.scalar.value,"LiteralData",10)==0 274 || strncasecmp(token.data.scalar.value,"ComplexOutput",13)==0 || strncasecmp(token.data.scalar.value,"LiteralOutput",12)==0 275 || strncasecmp(token.data.scalar.value,"BoundingBoxOutput",13)==0 || strncasecmp(token.data.scalar.value,"BoundingBoxData",12)==0){ 276 current_element->format=zStrdup(token.data.scalar.value); 273 if(strncasecmp((char *)token.data.scalar.value,"ComplexData",11)==0 || 274 strncasecmp((char *)token.data.scalar.value,"LiteralData",10)==0 || 275 strncasecmp((char *)token.data.scalar.value,"ComplexOutput",13)==0 || 276 strncasecmp((char *)token.data.scalar.value,"LiteralOutput",12)==0 || 277 strncasecmp((char *)token.data.scalar.value,"BoundingBoxOutput",13)==0 || 278 strncasecmp((char *)token.data.scalar.value,"BoundingBoxData",12)==0){ 279 current_element->format=zStrdup((char *)token.data.scalar.value); 277 280 free(cur_key); 278 281 cur_key=NULL; … … 324 327 plevel=level; 325 328 current_element=(elements*)malloc(ELEMENTS_SIZE); 326 current_element->name= strdup(token.data.scalar.value);329 current_element->name=zStrdup((char *)token.data.scalar.value); 327 330 current_element->content=NULL; 328 331 current_element->metadata=NULL; … … 367 370 plevel=level; 368 371 current_element=(elements*)malloc(ELEMENTS_SIZE); 369 current_element->name= strdup(token.data.scalar.value);372 current_element->name=zStrdup((char *)token.data.scalar.value); 370 373 current_element->content=NULL; 371 374 current_element->metadata=NULL; -
trunk/zoo-project/zoo-kernel/ulinet.c
r478 r490 27 27 28 28 #define _ULINET 29 #define MAX_WAIT_MSECS 180*1000 /* Wait max. 180 seconds */ 29 30 #include "ulinet.h" 30 31 #include <assert.h> … … 162 163 #endif 163 164 164 HINTERNET InternetOpen(char* lpszAgent,int dwAccessType,char* lpszProxyName,char* lpszProxyBypass,int dwFlags){ 165 165 HINTERNET InternetOpen(char* lpszAgent,int dwAccessType,char* lpszProxyName,char* lpszProxyBypass,int dwFlags){ 166 166 HINTERNET ret; 167 struct MemoryStruct header; 167 ret.handle=curl_multi_init(); 168 ret.ihandle=NULL; 168 169 ret.hasCacheFile=0; 169 170 ret.nDataAlloc = 0; 170 171 ret.mimeType = NULL; 171 172 curl_global_init(CURL_GLOBAL_ALL|CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32); 173 ret.handle=curl_easy_init(); 174 175 curl_easy_setopt(ret.handle, CURLOPT_COOKIEFILE, "ALL"); 176 #ifndef TIGER 177 curl_easy_setopt(ret.handle, CURLOPT_COOKIELIST, "ALL"); 178 #endif 179 curl_easy_setopt(ret.handle, CURLOPT_USERAGENT, lpszAgent); 180 181 curl_easy_setopt(ret.handle,CURLOPT_FOLLOWLOCATION,1); 182 curl_easy_setopt(ret.handle,CURLOPT_MAXREDIRS,3); 183 184 header.memory=NULL; 185 header.size = 0; 186 187 curl_easy_setopt(ret.handle, CURLOPT_HEADERFUNCTION, header_write_data); 188 curl_easy_setopt(ret.handle, CURLOPT_WRITEHEADER, (void *)&header); 189 190 #ifdef MSG_LAF_VERBOSE 191 curl_easy_setopt(ret.handle, CURLOPT_VERBOSE, 1); 192 #endif 193 172 ret.agent=strdup(lpszAgent); 194 173 return ret; 195 174 } … … 206 185 handle.nDataAlloc = handle.nDataLen = 0; 207 186 } 187 if(handle.ihandle!=NULL) 188 curl_easy_cleanup(handle.ihandle); 208 189 if(handle.handle) 209 curl_ easy_cleanup(handle.handle);210 curl_global_cleanup();190 curl_multi_cleanup(handle.handle); 191 free(handle.agent); 211 192 } 212 193 … … 214 195 215 196 char filename[255]; 197 struct MemoryStruct header; 198 216 199 hInternet.nDataLen = 0; 217 200 218 201 hInternet.nDataAlloc = 0; 219 202 hInternet.pabyData= NULL; 203 204 if(hInternet.ihandle!=NULL) 205 curl_easy_cleanup(hInternet.ihandle); 206 hInternet.ihandle=curl_easy_init( ); 207 curl_easy_setopt(hInternet.ihandle, CURLOPT_COOKIEFILE, "ALL"); 208 #ifndef TIGER 209 curl_easy_setopt(hInternet.ihandle, CURLOPT_COOKIELIST, "ALL"); 210 #endif 211 curl_easy_setopt(hInternet.ihandle, CURLOPT_USERAGENT, hInternet.agent); 212 213 curl_easy_setopt(hInternet.ihandle,CURLOPT_FOLLOWLOCATION,1); 214 curl_easy_setopt(hInternet.ihandle,CURLOPT_MAXREDIRS,3); 215 216 header.memory=NULL; 217 header.size = 0; 218 219 curl_easy_setopt(hInternet.ihandle, CURLOPT_HEADERFUNCTION, header_write_data); 220 curl_easy_setopt(hInternet.ihandle, CURLOPT_WRITEHEADER, (void *)&header); 221 222 #ifdef MSG_LAF_VERBOSE 223 curl_easy_setopt(hInternet.ihandle, CURLOPT_VERBOSE, 1); 224 #endif 225 220 226 221 227 switch(dwFlags) … … 223 229 case INTERNET_FLAG_NO_CACHE_WRITE: 224 230 hInternet.hasCacheFile=-1; 225 curl_easy_setopt(hInternet. handle, CURLOPT_WRITEFUNCTION, write_data_into);226 curl_easy_setopt(hInternet. handle, CURLOPT_WRITEDATA, &hInternet);231 curl_easy_setopt(hInternet.ihandle, CURLOPT_WRITEFUNCTION, write_data_into); 232 curl_easy_setopt(hInternet.ihandle, CURLOPT_WRITEDATA, &hInternet); 227 233 break; 228 234 default: … … 236 242 237 243 hInternet.hasCacheFile=1; 238 curl_easy_setopt(hInternet. handle, CURLOPT_WRITEFUNCTION, NULL);239 curl_easy_setopt(hInternet. handle, CURLOPT_WRITEDATA, hInternet.file);244 curl_easy_setopt(hInternet.ihandle, CURLOPT_WRITEFUNCTION, NULL); 245 curl_easy_setopt(hInternet.ihandle, CURLOPT_WRITEDATA, hInternet.file); 240 246 hInternet.nDataLen=0; 241 247 break; … … 250 256 #endif 251 257 //curl_easy_setopt(hInternet.handle,CURLOPT_COOKIE,lpszHeaders); 252 curl_easy_setopt(hInternet. handle,CURLOPT_POST,1);258 curl_easy_setopt(hInternet.ihandle,CURLOPT_POST,1); 253 259 #ifdef ULINET_DEBUG 254 260 fprintf(stderr,"** (%s) %d **\n",lpszHeaders,dwHeadersLength); 255 curl_easy_setopt(hInternet. handle,CURLOPT_VERBOSE,1);256 #endif 257 curl_easy_setopt(hInternet. handle,CURLOPT_POSTFIELDS,lpszHeaders);261 curl_easy_setopt(hInternet.ihandle,CURLOPT_VERBOSE,1); 262 #endif 263 curl_easy_setopt(hInternet.ihandle,CURLOPT_POSTFIELDS,lpszHeaders); 258 264 //curl_easy_setopt(hInternet.handle,CURLOPT_POSTFIELDSIZE,dwHeadersLength+1); 259 265 if(hInternet.header!=NULL) 260 curl_easy_setopt(hInternet.handle,CURLOPT_HTTPHEADER,hInternet.header); 261 } 262 263 curl_easy_setopt(hInternet.handle,CURLOPT_URL,lpszUrl); 264 curl_easy_perform(hInternet.handle); 265 curl_easy_getinfo(hInternet.handle,CURLINFO_CONTENT_TYPE,&hInternet.mimeType); 266 curl_easy_setopt(hInternet.ihandle,CURLOPT_HTTPHEADER,hInternet.header); 267 } 268 269 curl_easy_setopt(hInternet.ihandle,CURLOPT_URL,lpszUrl); 270 271 curl_multi_add_handle(hInternet.handle,hInternet.ihandle); 272 273 int still_running=0; 274 int msgs_left=0; 275 do{ 276 curl_multi_perform(hInternet.handle, &still_running); 277 }while(still_running); 278 279 CURLMsg *msg=NULL; 280 while ((msg = curl_multi_info_read(hInternet.handle, &msgs_left))) { 281 if (msg->msg == CURLMSG_DONE) { 282 CURL *eh=NULL; 283 eh = msg->easy_handle; 284 curl_easy_getinfo(eh,CURLINFO_CONTENT_TYPE,&hInternet.mimeType); 285 } 286 else { 287 fprintf(stderr, "error: after curl_multi_info_read(), CURLMsg=%d\n", msg->msg); 288 } 289 } 290 curl_multi_remove_handle(hInternet.handle, hInternet.ihandle); 291 266 292 #ifdef ULINET_DEBUG 267 293 fprintf(stderr,"DEBUG MIMETYPE: %s\n",hInternet.mimeType); … … 274 300 memset(&CCookie[0],0,1024); 275 301 #ifndef TIGER 276 curl_easy_setopt(hInternet. handle, CURLOPT_COOKIELIST, "ALL");302 curl_easy_setopt(hInternet.ihandle, CURLOPT_COOKIELIST, "ALL"); 277 303 #endif 278 304 return 1; -
trunk/zoo-project/zoo-kernel/ulinet.h
r471 r490 64 64 65 65 typedef struct { 66 CURLSH *handle; 66 CURLM *handle; 67 CURL *ihandle; 67 68 struct curl_slist *header; 68 69 char* filename; 70 char *agent; 69 71 FILE* file; 70 72 size_t size; -
trunk/zoo-project/zoo-kernel/zoo_loader.c
r465 r490 54 54 55 55 xmlXPathObjectPtr extractFromDoc(xmlDocPtr,const char*); 56 int runRequest(map* );56 int runRequest(map**); 57 57 58 58 using namespace std; … … 91 91 if(strncmp(cgiContentType,"text/xml",8)==0 || 92 92 strncasecmp(cgiRequestMethod,"post",4)==0){ 93 if(cgiContentLength==NULL){ 94 cgiContentLength=0; 93 if(cgiContentLength==0){ 95 94 char *buffer=new char[2]; 96 95 char *res=NULL; 97 96 int r=0; 98 97 while((r=fread(buffer,sizeof(char),1,cgiIn))){ 98 buffer[1]=0; 99 99 cgiContentLength+=r; 100 100 if(res==NULL){ 101 res=(char*)malloc( 1*sizeof(char));101 res=(char*)malloc(2*sizeof(char)); 102 102 sprintf(res,"%s",buffer); 103 103 } 104 104 else{ 105 res=(char*)realloc(res,(cgiContentLength+1)*sizeof(char));106 105 char *tmp=zStrdup(res); 106 res=(char*)realloc(res,(strlen(tmp)+2)*sizeof(char)); 107 107 sprintf(res,"%s%s",tmp,buffer); 108 108 free(tmp); 109 109 } 110 110 } 111 delete[] buffer; 111 112 if(res==NULL && (strQuery==NULL || strlen(strQuery)==0)){ 112 113 return errorException(NULL,"ZOO-Kernel failed to process your request cause the request was emtpty.","InternalError",NULL); … … 114 115 if(strQuery==NULL || strlen(strQuery)==0) 115 116 tmpMap=createMap("request",res); 116 } 117 } 118 if(res!=NULL) 119 free(res); 117 120 }else{ 118 121 char *buffer=new char[cgiContentLength+1]; 119 if(fread(buffer,sizeof(char),cgiContentLength,cgiIn)> =0){122 if(fread(buffer,sizeof(char),cgiContentLength,cgiIn)>0){ 120 123 buffer[cgiContentLength]=0; 121 124 tmpMap=createMap("request",buffer); … … 146 149 arrayStep++; 147 150 } 148 tmpMap=createMap("request",buffer); 151 if(tmpMap!=NULL) 152 addToMap(tmpMap,"request",buffer); 153 else 154 tmpMap=createMap("request",buffer); 149 155 } 150 156 delete[]buffer; … … 202 208 #endif 203 209 ){ 204 /**205 * First include the MetaPath and the ServiceProvider default parameters206 * (which should be always available in GET params so in cgiQueryString)207 */208 char *str1;209 str1=cgiQueryString;210 210 /** 211 211 * Store the original XML request in xrequest map … … 232 232 } 233 233 } 234 xmlXPathFreeObject(reqptr); 234 235 } 235 236 } … … 239 240 tval=NULL; 240 241 tval = (char*) xmlGetProp(cur,BAD_CAST "service"); 241 if(tval!=NULL) 242 if(tval!=NULL){ 242 243 addToMap(tmpMap,"service",tval); 244 xmlFree(tval); 245 } 243 246 tval=NULL; 244 247 tval = (char*) xmlGetProp(cur,BAD_CAST "language"); 245 if(tval!=NULL) 248 if(tval!=NULL){ 246 249 addToMap(tmpMap,"language",tval); 250 xmlFree(tval); 251 } 247 252 const char* requests[3]={"GetCapabilities","DescribeProcess","Execute"}; 248 253 for(int j=0;j<3;j++){ … … 256 261 #endif 257 262 if(req!=NULL && req->nodeNr==1){ 263 if(t1->value!=NULL) 264 free(t1->value); 258 265 t1->value=zStrdup(requests[j]); 259 266 j=2; … … 272 279 tval=NULL; 273 280 tval = (char*) xmlGetProp(cur,BAD_CAST "version"); 274 if(tval!=NULL) 281 if(tval!=NULL){ 275 282 addToMap(tmpMap,"version",tval); 283 xmlFree(tval); 284 } 276 285 tval = (char*) xmlGetProp(cur,BAD_CAST "language"); 277 if(tval!=NULL) 286 if(tval!=NULL){ 278 287 addToMap(tmpMap,"language",tval); 288 xmlFree(tval); 289 } 279 290 xmlXPathObjectPtr idptr=extractFromDoc(doc,"/*/*[local-name()='Identifier']"); 280 291 if(idptr!=NULL){ … … 343 354 if(strQuery!=NULL) 344 355 free(strQuery); 345 runRequest(tmpMap); 356 357 runRequest(&tmpMap); 346 358 347 359 /** 348 360 * Required but can't be made after executing a process using POST requests. 349 361 */ 350 if( strncasecmp(cgiRequestMethod,"post",4)!=0 && count(tmpMap)!=1 &&tmpMap!=NULL){362 if(/*strncasecmp(cgiRequestMethod,"post",4)!=0 && count(tmpMap)!=1 && */tmpMap!=NULL){ 351 363 freeMap(&tmpMap); 352 364 free(tmpMap); -
trunk/zoo-project/zoo-kernel/zoo_service_loader.c
r488 r490 221 221 sprintf(prefix,"%s.",dp->d_name); 222 222 223 map* tmpMap=getMapFromMaps(m,"lenv",tmp1);223 //map* tmpMap=getMapFromMaps(m,"lenv",tmp1); 224 224 225 225 int res; … … 467 467 fprintf(stderr,"Function %s error %s\n",r_inputs->value,errstr); 468 468 #endif 469 *eres=-1; 469 470 return; 470 471 } … … 661 662 #endif 662 663 663 int runRequest(map* request_inputs)664 int runRequest(map** inputs) 664 665 { 665 666 666 667 #ifndef USE_GDB 667 668 (void) signal(SIGSEGV,sig_handler); … … 674 675 675 676 map* r_inputs=NULL; 677 map* request_inputs=*inputs; 676 678 maps* m=NULL; 677 678 679 char* REQUEST=NULL; 679 680 /** … … 788 789 if(request_inputs==NULL || r_inputs==NULL){ 789 790 errorException(m, _("Parameter <request> was not specified"),"MissingParameterValue","request"); 790 freeMap(&request_inputs); 791 free(request_inputs); 791 if(count(request_inputs)==1){ 792 freeMap(&request_inputs); 793 free(request_inputs); 794 } 792 795 freeMaps(&m); 793 796 free(m); … … 871 874 872 875 if(strncasecmp(REQUEST,"GetCapabilities",15)==0){ 873 struct dirent *dp;874 876 #ifdef DEBUG 875 877 dumpMap(r_inputs); … … 1622 1624 #endif 1623 1625 if(hai==0){ 1624 key=(char*)malloc((1+strlen((char*)val))*sizeof(char)); 1625 snprintf(key,1+strlen((char*)val),"%s",(char*)val); 1626 key=zStrdup((char*)val); 1626 1627 }else{ 1627 has=(char*)malloc(( 3+strlen((char*)val)+strlen(key))*sizeof(char));1628 has=(char*)malloc((4+xmlStrlen(val)+strlen(key))*sizeof(char)); 1628 1629 if(has == NULL){ 1629 1630 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 1630 1631 } 1631 snprintf(has,(3+strlen((char*)val)+strlen(key)),"%s: %s",key,(char*)val); 1632 snprintf(has,(3+xmlStrlen(val)+strlen(key)),"%s: %s",key,(char*)val); 1633 free(key); 1632 1634 #ifdef POST_DEBUG 1633 1635 fprintf(stderr,"%s\n",has); 1634 1636 #endif 1635 1637 } 1638 xmlFree(val); 1636 1639 } 1637 1640 hInternetP.header=curl_slist_append(hInternetP.header, has); … … 1647 1650 fprintf(stderr,"Body part found !!!\n",(char*)cur3->content); 1648 1651 #endif 1649 char *tmp= new char[cgiContentLength];1652 char *tmp=(char*)malloc(cgiContentLength+1*sizeof(char)); 1650 1653 memset(tmp,0,cgiContentLength); 1651 1654 xmlNodePtr cur4=cur3->children; … … 1664 1667 if(btmps!=NULL) 1665 1668 sprintf(tmp,"%s",(char*)btmps); 1669 xmlFree(btmps); 1670 cur4=cur4->next; 1666 1671 xmlFreeDoc(bdoc); 1667 cur4=cur4->next;1668 1672 } 1669 1673 map *btmp=getMap(tmpmaps->content,"href"); … … 1686 1690 curl_slist_free_all(hInternetP.header); 1687 1691 addToMap(tmpmaps->content,"value",tmpContent); 1692 free(tmpContent); 1688 1693 #ifdef POST_DEBUG 1689 1694 fprintf(stderr,"DL CONTENT : (%s)\n",tmpContent); 1690 #endif 1695 #endif 1691 1696 } 1697 free(tmp); 1692 1698 } 1693 1699 else … … 1842 1848 sprintf(size,"%d",buffersize); 1843 1849 addToMap(tmpmaps->content,"size",size); 1850 xmlFreeDoc(doc1); 1844 1851 } 1845 1852 addToMap(tmpmaps->content,"value",(char*)mv); … … 2137 2144 } 2138 2145 xmlXPathFreeObject(tmpsptr); 2146 xmlFreeDoc(doc); 2139 2147 xmlCleanupParser(); 2140 2148 } … … 2168 2176 char tmps[1024]; 2169 2177 map* tmpe=createMap("code","FileSizeExceeded"); 2170 snprintf(tmps,1024,_("The <%s> parameter has a limited size (%sMB) defined in ZOO ServicesProvider configuration file but the reference you provided exceed this limitation (% dMB), please correct your query or the ZOO Configuration file."),ptr->name,tmp1->value,i);2178 snprintf(tmps,1024,_("The <%s> parameter has a limited size (%sMB) defined in ZOO ServicesProvider configuration file but the reference you provided exceed this limitation (%fMB), please correct your query or the ZOO Configuration file."),ptr->name,tmp1->value,i); 2171 2179 addToMap(tmpe,"locator",ptr->name); 2172 2180 addToMap(tmpe,"text",tmps); … … 2230 2238 cgiFilePtr file; 2231 2239 int targetFile; 2232 mode_t mode;2233 2240 char storageNameOnServer[2048]; 2234 2241 char fileNameOnServer[64]; … … 2259 2266 fprintf(stderr,"fileNameOnServer: %s\n",fileNameOnServer); 2260 2267 #endif 2261 mode=S_IRWXU|S_IRGRP|S_IROTH;2262 2268 targetFile = open (storageNameOnServer,O_RDWR|O_CREAT|O_TRUNC,S_IRWXU|S_IRGRP|S_IROTH); 2263 2269 if(targetFile<0){ … … 2408 2414 char *tcook=zStrdup(cgiCookie); 2409 2415 char *tmp=NULL; 2410 int hasVal=-1;2411 2416 map* testing=getMapFromMaps(m,"main","cookiePrefix"); 2412 2417 if(testing==NULL){ … … 2415 2420 tmp=(char*)malloc((strlen(testing->value)+2)*sizeof(char)); 2416 2421 sprintf(tmp,"%s=",testing->value); 2417 hasVal=1;2418 2422 } 2419 2423 if(strstr(cgiCookie,";")!=NULL){ … … 2585 2589 (void) signal(SIGABRT,donothing); 2586 2590 #endif 2587 2588 2591 if(((int)getpid())!=cpid || cgiSid!=NULL){ 2589 2592 fclose(stdout); … … 2608 2611 unlink(fbkp1); 2609 2612 free(fbkp1); 2613 free(tmps1); 2610 2614 } 2611 2615
Note: See TracChangeset
for help on using the changeset viewer.