Changeset 453 for trunk/zoo-project/zoo-kernel/service_internal.c
- Timestamp:
- Feb 12, 2014, 3:25:15 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service_internal.c
r452 r453 1212 1212 map* tmpm2=getMap(tmp_maps->content,"tmpUrl"); 1213 1213 if(tmpm1!=NULL && tmpm2!=NULL){ 1214 if(strncasecmp(tmpm2->value,"http://",7)==0){ 1214 if( strncasecmp( tmpm2->value, "http://", 7) == 0 || 1215 strncasecmp( tmpm2->value, "https://", 8 ) == 0 ){ 1215 1216 sprintf(url,"%s/%s_%i.xml",tmpm2->value,service,pid); 1216 1217 }else … … 1892 1893 map * errormap = createMap("text",tmpMsg); 1893 1894 addToMap(errormap,"code", "InternalError"); 1895 1894 1896 printExceptionReportResponse(m,errormap); 1895 1897 freeMap(&errormap); … … 1903 1905 } 1904 1906 1907 if(res==SERVICE_FAILED){ 1908 map * errormap; 1909 map *lenv; 1910 lenv=getMapFromMaps(m,"lenv","message"); 1911 char *tmp0; 1912 if(lenv!=NULL){ 1913 tmp0=(char*)malloc((strlen(lenv->value)+strlen(_("Unable to run the Service. The message returned back by the Service was the following: "+1)))*sizeof(char)); 1914 sprintf(tmp0,_("Unable to run the Service. The message returned back by the Service was the following: %s"),lenv->value); 1915 } 1916 else{ 1917 tmp0=(char*)malloc((strlen(_("Unable to run the Service. No more information was returned back by the Service."))+1)*sizeof(char)); 1918 sprintf(tmp0,_("Unable to run the Service. No more information was returned back by the Service.")); 1919 } 1920 errormap = createMap("text",tmp0); 1921 free(tmp0); 1922 addToMap(errormap,"code", "InternalError"); 1923 printExceptionReportResponse(m,errormap); 1924 freeMap(&errormap); 1925 free(errormap); 1926 return; 1927 } 1928 1905 1929 if(asRaw==0){ 1906 1930 #ifdef DEBUG … … 1915 1939 toto=getMap(tmpI->content,"asReference"); 1916 1940 #ifdef USE_MS 1917 if(toto!=NULL && strcasecmp(toto->value,"true")==0 && testMap==NULL) {1941 if(toto!=NULL && strcasecmp(toto->value,"true")==0 && testMap==NULL) 1918 1942 #else 1919 if(toto!=NULL && strcasecmp(toto->value,"true")==0){ 1920 #endif 1943 if(toto!=NULL && strcasecmp(toto->value,"true")==0) 1944 #endif 1945 { 1921 1946 elements* in=getElements(s->outputs,tmpI->name); 1922 1947 char *format=NULL; … … 1933 1958 map *ext=getMap(tmpI->content,"extension"); 1934 1959 map *tmp1=getMapFromMaps(m,"main","tmpPath"); 1935 char *file_name ;1960 char *file_name,*file_path; 1936 1961 bool hasExt=true; 1937 1962 if(ext==NULL){ … … 1957 1982 hasExt=false; 1958 1983 } 1959 file_name=(char*)malloc((strlen(tmp1->value)+strlen(s->name)+strlen(ext->value)+strlen(tmpI->name)+13)*sizeof(char)); 1960 sprintf(file_name,"%s/%s_%s_%i.%s",tmp1->value,s->name,tmpI->name,cpid+100000,ext->value); 1961 FILE *ofile=fopen(file_name,"wb"); 1984 file_name=(char*)malloc((strlen(s->name)+strlen(ext->value)+strlen(tmpI->name)+1024)*sizeof(char)); 1985 int cpid0=cpid+time(NULL); 1986 sprintf(file_name,"%s_%s_%i.%s",s->name,tmpI->name,cpid0,ext->value); 1987 file_path=(char*)malloc((strlen(tmp1->value)+strlen(file_name)+2)*sizeof(char)); 1988 sprintf(file_path,"%s/%s",tmp1->value,file_name); 1989 FILE *ofile=fopen(file_path,"wb"); 1962 1990 if(ofile==NULL){ 1963 1991 char tmpMsg[1024]; … … 1968 1996 freeMap(&errormap); 1969 1997 free(errormap); 1998 free(file_name); 1999 free(file_path); 1970 2000 return; 1971 2001 } 2002 free(file_path); 1972 2003 map *tmp2=getMapFromMaps(m,"main","tmpUrl"); 1973 2004 map *tmp3=getMapFromMaps(m,"main","serverAddress"); 1974 2005 char *file_url; 1975 2006 if(strncasecmp(tmp2->value,"http://",7)==0){ 1976 file_url=(char*)malloc((strlen(tmp2->value)+strlen( s->name)+strlen(ext->value)+strlen(tmpI->name)+13)*sizeof(char));1977 sprintf(file_url,"%s/%s _%s_%i.%s",tmp2->value,s->name,tmpI->name,cpid+100000,ext->value);2007 file_url=(char*)malloc((strlen(tmp2->value)+strlen(file_name))*sizeof(char)); 2008 sprintf(file_url,"%s/%s",tmp2->value,file_name); 1978 2009 }else{ 1979 file_url=(char*)malloc((strlen(tmp3->value)+strlen(tmp2->value)+strlen( s->name)+strlen(ext->value)+strlen(tmpI->name)+13)*sizeof(char));1980 sprintf(file_url,"%s/%s/%s _%s_%i.%s",tmp3->value,tmp2->value,s->name,tmpI->name,cpid+100000,ext->value);2010 file_url=(char*)malloc((strlen(tmp3->value)+strlen(tmp2->value)+strlen(file_name))*sizeof(char)); 2011 sprintf(file_url,"%s/%s/%s",tmp3->value,tmp2->value,file_name); 1981 2012 } 1982 2013 addToMap(tmpI->content,"Reference",file_url); … … 2019 2050 request_inputs, 2020 2051 request_outputs); 2021 } 2022 else 2023 if(res!=SERVICE_FAILED){ 2052 } 2053 else{ 2024 2054 /** 2025 2055 * We get the requested output or fallback to the first one if the … … 2083 2113 #endif 2084 2114 } 2085 }else{2086 char tmp[1024];2087 map * errormap;2088 map *lenv;2089 lenv=getMapFromMaps(m,"lenv","message");2090 if(lenv!=NULL)2091 sprintf(tmp,_("Unable to run the Service. The message returned back by the Service was the following : %s"),lenv->value);2092 else2093 sprintf(tmp,_("Unable to run the Service. No more information was returned back by the Service."));2094 errormap = createMap("text",tmp);2095 addToMap(errormap,"code", "InternalError");2096 printExceptionReportResponse(m,errormap);2097 freeMap(&errormap);2098 free(errormap);2099 2115 } 2100 2116 }
Note: See TracChangeset
for help on using the changeset viewer.