Changeset 383 for trunk/zoo-project/zoo-kernel/service_internal.c
- Timestamp:
- Jan 8, 2013, 3:54:57 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service_internal.c
r379 r383 1745 1745 xmlNodePtr n; 1746 1746 1747 printHeaders(m); 1747 1748 doc = xmlNewDoc(BAD_CAST "1.0"); 1748 1749 maps* tmpMap=getMaps(m,"main"); … … 1899 1900 // mimeType information if present here. Maybe we can add more formats 1900 1901 // here. 1901 // If mimeType was not found, we then set txt as the default extension .1902 // If mimeType was not found, we then set txt as the default extension 1902 1903 map* mtype=getMap(tmpI->content,"mimeType"); 1903 1904 if(mtype!=NULL){ … … 1919 1920 file_name=(char*)malloc((strlen(tmp1->value)+strlen(s->name)+strlen(ext->value)+strlen(tmpI->name)+13)*sizeof(char)); 1920 1921 sprintf(file_name,"%s/%s_%s_%i.%s",tmp1->value,s->name,tmpI->name,cpid+100000,ext->value); 1921 FILE *ofile=fopen(file_name,"w ");1922 FILE *ofile=fopen(file_name,"wb"); 1922 1923 if(ofile==NULL) 1923 1924 fprintf(stderr,"Unable to create file on disk implying segfault ! \n"); … … 2000 2001 return; 2001 2002 } 2003 map* fname=getMapFromMaps(tmpI,tmpI->name,"filename"); 2004 if(fname!=NULL) 2005 printf("Content-Disposition: attachment; filename=\"%s\"\r\n",fname->value); 2006 map* rs=getMapFromMaps(tmpI,tmpI->name,"size"); 2007 if(rs!=NULL) 2008 printf("Content-Length: %s\r\n",rs->value); 2009 2002 2010 char mime[1024]; 2003 2011 map* mi=getMap(tmpI->content,"mimeType"); … … 2020 2028 sprintf(mime,"Content-Type: text/plain; charset=utf-8\r\nStatus: 200 OK\r\n\r\n"); 2021 2029 printf("%s",mime); 2022 if(mi!=NULL && strncmp(mi->value,"image",5)==0){ 2023 map* rs=getMapFromMaps(tmpI,tmpI->name,"size"); 2030 if(rs!=NULL) 2024 2031 fwrite(toto->value,atoi(rs->value),1,stdout); 2025 }2026 2032 else 2027 printf("%s",toto->value);2033 fwrite(toto->value,strlen(toto->value),1,stdout); 2028 2034 #ifdef DEBUG 2029 2035 dumpMap(toto);
Note: See TracChangeset
for help on using the changeset viewer.