Changeset 453 for trunk/zoo-project/zoo-kernel/zoo_service_loader.c
- Timestamp:
- Feb 12, 2014, 3:25:15 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/zoo_service_loader.c
r452 r453 64 64 #endif 65 65 66 #ifdef USE_RUBY 67 #include "service_internal_ruby.h" 68 #endif 69 66 70 #ifdef USE_PERL 67 71 #include "service_internal_perl.h" … … 91 95 #ifndef USE_MS 92 96 { 93 char *x=_ strdup(a);94 char *y=_ strdup(b);97 char *x=_zStrdup(a); 98 char *y=_zStrdup(b); 95 99 96 100 x=_strlwr(x); … … 250 254 else 251 255 sprintf(tmps1,"%s/",ntmp); 252 char *altPath= strdup(tmps1);256 char *altPath=zStrdup(tmps1); 253 257 r_inputs=getMap(s1->content,"ServiceProvider"); 254 258 sprintf(tmps1,"%s/%s",altPath,r_inputs->value); … … 419 423 else 420 424 #endif 425 426 #ifdef USE_RUBY 427 if(strncasecmp(r_inputs->value,"Ruby",4)==0){ 428 *eres=zoo_ruby_support(&m,request_inputs,s1,&request_input_real_format,&request_output_real_format); 429 } 430 else 431 #endif 432 421 433 { 422 434 char tmpv[1024]; … … 479 491 free(r_inputs1); 480 492 } 481 char *tmp1= strdup(tmp);493 char *tmp1=zStrdup(tmp); 482 494 sprintf(tmp,"zoo_loader.cgi %s \"%s\"",tmp1,sid->value); 483 495 … … 594 606 r_inputs=getMapFromMaps(m,"main","language"); 595 607 if(r_inputs!=NULL){ 596 char *tmp= strdup(r_inputs->value);608 char *tmp=zStrdup(r_inputs->value); 597 609 setMapInMaps(m,"main","language",tmp); 598 610 translateChar(tmp,'-','_'); … … 650 662 } 651 663 else{ 652 REQUEST= strdup(r_inputs->value);664 REQUEST=zStrdup(r_inputs->value); 653 665 if(strncasecmp(r_inputs->value,"GetCapabilities",15)!=0 654 666 && strncasecmp(r_inputs->value,"DescribeProcess",15)!=0 … … 689 701 map* tmpm=getMapFromMaps(m,"main","serverAddress"); 690 702 if(tmpm!=NULL) 691 SERVICE_URL= strdup(tmpm->value);703 SERVICE_URL=zStrdup(tmpm->value); 692 704 else 693 SERVICE_URL= strdup(DEFAULT_SERVICE_URL);705 SERVICE_URL=zStrdup(DEFAULT_SERVICE_URL); 694 706 695 707 service* s1; … … 883 895 snprintf(tmps1,1024,"%s/",ntmp); 884 896 r_inputs=getMap(request_inputs,"Identifier"); 885 char *ttmp= strdup(tmps1);897 char *ttmp=zStrdup(tmps1); 886 898 snprintf(tmps1,1024,"%s/%s.zcfg",ttmp,r_inputs->value); 887 899 free(ttmp); … … 956 968 #endif 957 969 char cursor_output[10240]; 958 char *cotmp= strdup(r_inputs->value);970 char *cotmp=zStrdup(r_inputs->value); 959 971 snprintf(cursor_output,10240,"%s",cotmp); 960 972 free(cotmp); … … 990 1002 } 991 1003 for(j=0;j<i;j++){ 992 char *tmp= strdup(outputs_as_text[j]);1004 char *tmp=zStrdup(outputs_as_text[j]); 993 1005 free(outputs_as_text[j]); 994 1006 char *tmpc; … … 1002 1014 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1003 1015 } 1004 tmp_output->name= strdup(tmpc);1016 tmp_output->name=zStrdup(tmpc); 1005 1017 tmp_output->content=NULL; 1006 1018 tmp_output->next=NULL; … … 1072 1084 * Put each DataInputs into the inputs_as_text array 1073 1085 */ 1074 char *tmp1= strdup(cursor_input);1086 char *tmp1=zStrdup(cursor_input); 1075 1087 char * pToken; 1076 1088 pToken=strtok(cursor_input,";"); … … 1106 1118 1107 1119 for(j=0;j<i;j++){ 1108 char *tmp= strdup(inputs_as_text[j]);1120 char *tmp=zStrdup(inputs_as_text[j]); 1109 1121 free(inputs_as_text[j]); 1110 1122 char *tmpc; … … 1133 1145 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1134 1146 } 1135 tmpmaps->name= strdup(tmpn);1147 tmpmaps->name=zStrdup(tmpn); 1136 1148 if(tmpv!=NULL){ 1137 1149 char *tmpvf=url_decode(tmpv+1); … … 1166 1178 sprintf(tmpValue,"%s@%s",tmpv+1,tmpc); 1167 1179 free(lmap->value); 1168 lmap->value= strdup(tmpValue);1180 lmap->value=zStrdup(tmpValue); 1169 1181 free(tmpValue); 1170 1182 tmpc=strtok(NULL,"@"); … … 1181 1193 char *tmpx2=url_decode(tmpv1+1); 1182 1194 if(strncasecmp(tmpx2,"http://",7)!=0 && 1183 strncasecmp(tmpx2,"ftp://",6)!=0){ 1195 strncasecmp(tmpx2,"ftp://",6)!=0 && 1196 strncasecmp(tmpx2,"https://",8)!=0){ 1184 1197 char emsg[1024]; 1185 1198 sprintf(emsg,_("Unable to find a valid protocol to download the remote file %s"),tmpv1+1); … … 1303 1316 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1304 1317 } 1305 tmpmaps->name= strdup((char*)val);1318 tmpmaps->name=zStrdup((char*)val); 1306 1319 tmpmaps->content=NULL; 1307 1320 tmpmaps->next=NULL; … … 1321 1334 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1322 1335 } 1323 tmpmaps->name= strdup("missingIndetifier");1336 tmpmaps->name=zStrdup("missingIndetifier"); 1324 1337 tmpmaps->content=createMap((char*)cur2->name,(char*)val); 1325 1338 tmpmaps->next=NULL; … … 1563 1576 */ 1564 1577 char *list[2]; 1565 list[0]= strdup("dataType");1566 list[1]= strdup("uom");1578 list[0]=zStrdup("dataType"); 1579 list[1]=zStrdup("uom"); 1567 1580 for(int l=0;l<2;l++){ 1568 1581 #ifdef DEBUG … … 1656 1669 } 1657 1670 free(tmpv->value); 1658 tmpv->value= strdup(res);1671 tmpv->value=zStrdup(res); 1659 1672 free(res); 1660 1673 xmlFree(tmp); … … 1741 1754 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1742 1755 } 1743 tmpmaps->name= strdup("unknownIdentifier");1756 tmpmaps->name=zStrdup("unknownIdentifier"); 1744 1757 tmpmaps->content=NULL; 1745 1758 tmpmaps->next=NULL; … … 1783 1796 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1784 1797 } 1785 tmpmaps->name= strdup((char*)val);1798 tmpmaps->name=zStrdup((char*)val); 1786 1799 tmpmaps->content=NULL; 1787 1800 tmpmaps->next=NULL; … … 1789 1802 else{ 1790 1803 //free(tmpmaps->name); 1791 tmpmaps->name= strdup((char*)val);1804 tmpmaps->name=zStrdup((char*)val); 1792 1805 } 1793 1806 if(asRaw==true) … … 1798 1811 else{ 1799 1812 map* tt=getMap(request_inputs,"ResponseDocument"); 1800 char* tmp= strdup(tt->value);1813 char* tmp=zStrdup(tt->value); 1801 1814 free(tt->value); 1802 1815 tt->value=(char*)malloc((strlen(tmp)+strlen((char*)val)+1)*sizeof(char)); … … 1820 1833 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1821 1834 } 1822 tmpmaps->name= strdup("missingIndetifier");1835 tmpmaps->name=zStrdup("missingIndetifier"); 1823 1836 tmpmaps->content=createMap((char*)cur1->name,(char*)val); 1824 1837 tmpmaps->next=NULL; … … 1869 1882 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1870 1883 } 1871 tmpmaps->name= strdup((char*)val);1884 tmpmaps->name=zStrdup((char*)val); 1872 1885 tmpmaps->content=NULL; 1873 1886 tmpmaps->next=NULL; … … 1876 1889 if(tmpmaps->name!=NULL) 1877 1890 free(tmpmaps->name); 1878 tmpmaps->name= strdup((char*)val);;1891 tmpmaps->name=zStrdup((char*)val);; 1879 1892 } 1880 1893 xmlFree(val); … … 1892 1905 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1893 1906 } 1894 tmpmaps->name= strdup("missingIndetifier");1907 tmpmaps->name=zStrdup("missingIndetifier"); 1895 1908 tmpmaps->content=createMap((char*)cur2->name,(char*)val); 1896 1909 tmpmaps->next=NULL; … … 2125 2138 int cpid=getpid(); 2126 2139 2140 /** 2141 * Initialize the specific [lenv] section which contains runtime variables: 2142 * 2143 * - usid : it is an unique identification number 2144 * - sid : it is the process idenfitication number (OS) 2145 * - status : value between 0 and 100 to express the completude of 2146 * the operations of the running service 2147 * - message : is a string where you can store error messages, in case 2148 * service is failing, or o provide details on the ongoing operation. 2149 * - cwd : is the current working directory 2150 * - soap : is a boolean value, true if the request was contained in a SOAP 2151 * Envelop 2152 * - sessid : string storing the session identifier (only when cookie is 2153 * used) 2154 * - cgiSid : only defined on Window platforms (for being able to identify 2155 * the created process) 2156 * 2157 */ 2127 2158 maps *_tmpMaps=(maps*)malloc(MAPS_SIZE); 2128 _tmpMaps->name= strdup("lenv");2159 _tmpMaps->name=zStrdup("lenv"); 2129 2160 char tmpBuff[100]; 2161 sprintf(tmpBuff,"%i",(cpid+(int)time(NULL))); 2162 _tmpMaps->content=createMap("usid",tmpBuff); 2163 _tmpMaps->next=NULL; 2130 2164 sprintf(tmpBuff,"%i",cpid); 2131 _tmpMaps->content=createMap("sid",tmpBuff); 2132 _tmpMaps->next=NULL; 2165 addToMap(_tmpMaps->content,"sid",tmpBuff); 2133 2166 addToMap(_tmpMaps->content,"status","0"); 2167 addToMap(_tmpMaps->content,"message",_("No message provided")); 2134 2168 addToMap(_tmpMaps->content,"cwd",ntmp); 2135 2169 map* ltmp=getMap(request_inputs,"soap"); … … 2140 2174 if(cgiCookie!=NULL && strlen(cgiCookie)>0){ 2141 2175 int hasValidCookie=-1; 2142 char *tcook= strdup(cgiCookie);2176 char *tcook=zStrdup(cgiCookie); 2143 2177 char *tmp=NULL; 2144 2178 int hasVal=-1; 2145 2179 map* testing=getMapFromMaps(m,"main","cookiePrefix"); 2146 2180 if(testing==NULL){ 2147 tmp= strdup("ID=");2181 tmp=zStrdup("ID="); 2148 2182 }else{ 2149 2183 tmp=(char*)malloc((strlen(testing->value)+2)*sizeof(char)); … … 2158 2192 if(tcook!=NULL) 2159 2193 free(tcook); 2160 tcook= strdup(token);2194 tcook=zStrdup(token); 2161 2195 hasValidCookie=1; 2162 2196 } … … 2165 2199 }else{ 2166 2200 if(strstr(cgiCookie,"=")!=NULL && strcasestr(cgiCookie,tmp)!=NULL){ 2167 tcook= strdup(cgiCookie);2201 tcook=zStrdup(cgiCookie); 2168 2202 hasValidCookie=1; 2169 2203 }
Note: See TracChangeset
for help on using the changeset viewer.