Changeset 331 for trunk/zoo-project
- Timestamp:
- Sep 2, 2011, 11:20:31 PM (13 years ago)
- Location:
- trunk/zoo-project/zoo-kernel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/zoo_loader.c
r329 r331 76 76 #endif 77 77 78 char *strQuery=strdup(cgiQueryString); 78 79 map* tmpMap=NULL; 79 80 … … 107 108 buffer[cgiContentLength]=0; 108 109 tmpMap=createMap("request",buffer); 110 fprintf(stderr,"%s\n",tmpMap->value); 109 111 }else{ 110 112 buffer[0]=0; … … 141 143 } 142 144 else{ 145 dumpMap(tmpMap); 143 146 char **array, **arrayStep; 144 147 if (cgiFormEntries(&array) != cgiFormSuccess) { … … 179 182 */ 180 183 map* t1=getMap(tmpMap,"request"); 181 if(t1!=NULL ){184 if(t1!=NULL && strncasecmp(t1->value,"<",1)==0){ 182 185 addToMap(tmpMap,"xrequest",t1->value); 183 186 xmlInitParser(); … … 281 284 xmlFreeDoc(doc); 282 285 xmlCleanupParser(); 286 }else{ 287 freeMap(&tmpMap); 288 free(tmpMap); 289 tmpMap=createMap("not_valid","true"); 283 290 } 284 291 … … 297 304 token1=strtok_r(NULL,"=",&saveptr1); 298 305 } 299 if(strcasecmp(name,"metapath")==0) 300 addToMap(tmpMap,name,value); 306 addToMap(tmpMap,name,value); 301 307 free(name); 302 308 free(value); 309 name=NULL; 310 value=NULL; 303 311 token=strtok_r(NULL,"&",&saveptr); 304 312 } 305 313 306 314 } 315 316 317 if(strncasecmp(cgiContentType,"multipart/form-data",19)==0){ 318 map* tmp=getMap(tmpMap,"dataInputs"); 319 if(tmp!=NULL){ 320 addToMap(tmpMap,"dataInputs",strstr(strQuery,"dataInputs=")+11); 321 } 322 } 307 323 308 324 runRequest(tmpMap); -
trunk/zoo-project/zoo-kernel/zoo_service_loader.c
r328 r331 742 742 #endif 743 743 int saved_stdout = dup(fileno(stdout)); 744 744 dup2(fileno(stderr),fileno(stdout)); 745 745 t=getServiceFromFile(tmps1,&s1); 746 746 fflush(stdout); … … 1645 1645 */ 1646 1646 else if(xmlStrncasecmp(cur2->name,BAD_CAST "Title",xmlStrlen(cur2->name))==0 || 1647 xmlStrncasecmp(cur2->name,BAD_CAST "Abstract",xmlStrlen(cur2->name))==0){1647 xmlStrncasecmp(cur2->name,BAD_CAST "Abstract",xmlStrlen(cur2->name))==0){ 1648 1648 xmlChar *val= 1649 1649 xmlNodeListGetString(doc,cur2->xmlChildrenNode,1); … … 1733 1733 } 1734 1734 1735 maps* tmpReqI=request_input_real_format; 1736 while(tmpReqI!=NULL){ 1737 char name[1024]; 1738 if(getMap(tmpReqI->content,"isFile")!=NULL){ 1739 if (cgiFormFileName(tmpReqI->name, name, sizeof(name)) == cgiFormSuccess) { 1740 int BufferLen=1024; 1741 cgiFilePtr file; 1742 int targetFile; 1743 mode_t mode; 1744 char storageNameOnServer[2048]; 1745 char fileNameOnServer[64]; 1746 char contentType[1024]; 1747 char buffer[BufferLen]; 1748 char *tmpStr=NULL; 1749 int size; 1750 int got,t; 1751 map *path=getMapFromMaps(m,"main","tmpPath"); 1752 cgiFormFileSize(tmpReqI->name, &size); 1753 cgiFormFileContentType(tmpReqI->name, contentType, sizeof(contentType)); 1754 if (cgiFormFileOpen(tmpReqI->name, &file) == cgiFormSuccess) { 1755 t=-1; 1756 while(1){ 1757 tmpStr=strstr(name+t+1,"\\"); 1758 if(NULL==tmpStr) 1759 tmpStr=strstr(name+t+1,"/"); 1760 if(NULL!=tmpStr) 1761 t=(int)(tmpStr-name); 1762 else 1763 break; 1764 } 1765 strcpy(fileNameOnServer,name+t+1); 1766 1767 sprintf(storageNameOnServer,"%s/%s",path->value,fileNameOnServer); 1768 fprintf(stderr,"Name on server %s\n",storageNameOnServer); 1769 fprintf(stderr,"fileNameOnServer: %s\n",fileNameOnServer); 1770 mode=S_IRWXU|S_IRGRP|S_IROTH; 1771 targetFile = open (storageNameOnServer,O_RDWR|O_CREAT|O_TRUNC,mode); 1772 if(targetFile<0){ 1773 fprintf(stderr,"could not create the new file,%s\n",fileNameOnServer); 1774 }else{ 1775 while (cgiFormFileRead(file, buffer, BufferLen, &got) ==cgiFormSuccess){ 1776 if(got>0) 1777 write(targetFile,buffer,got); 1778 } 1779 } 1780 addToMap(tmpReqI->content,"lref",storageNameOnServer); 1781 cgiFormFileClose(file); 1782 close(targetFile); 1783 fprintf(stderr,"File \"%s\" has been uploaded",fileNameOnServer); 1784 } 1785 } 1786 } 1787 tmpReqI=tmpReqI->next; 1788 } 1789 1735 1790 ensureDecodedBase64(&request_input_real_format); 1736 1791 … … 1862 1917 char *cgiSidL=NULL; 1863 1918 if(getenv("CGISID")!=NULL) 1864 1919 addToMap(request_inputs,"cgiSid",getenv("CGISID")); 1865 1920 map* test1=getMap(request_inputs,"cgiSid"); 1866 1921 if(test1!=NULL){ … … 1959 2014 #ifdef DEBUG 1960 2015 dumpMaps(request_output_real_format); 1961 fprintf(stderr,"Function loaded and returned %d\n",*eres);1962 fflush(stderr);1963 2016 #endif 1964 2017 if(eres!=-1)
Note: See TracChangeset
for help on using the changeset viewer.