Changeset 99
- Timestamp:
- Jan 30, 2011, 7:41:13 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-kernel/zoo_loader.c
r95 r99 110 110 map* tmpMap=NULL; 111 111 112 if(strncmp(cgiContentType,"text/xml",8)==0 &&113 strncasecmp(cgiRequestMethod,"post",4) ){112 if(strncmp(cgiContentType,"text/xml",8)==0 || 113 strncasecmp(cgiRequestMethod,"post",4)==0){ 114 114 char *buffer=new char[cgiContentLength+1]; 115 115 if(fread(buffer,1,cgiContentLength,cgiIn)){ … … 117 117 tmpMap=createMap("request",buffer); 118 118 }else{ 119 /* Here we have to return an error message ... */ 120 fprintf(stderr, "Unable to read cgi content in zoo_loader.c line %i\n", __LINE__); 121 return 1; 119 char **array, **arrayStep; 120 if (cgiFormEntries(&array) != cgiFormSuccess) { 121 return 1; 122 } 123 arrayStep = array; 124 while (*arrayStep) { 125 char *value=new char[cgiContentLength]; 126 cgiFormStringNoNewlines(*arrayStep, value, cgiContentLength); 127 char* tmpValueFinal=(char*) malloc((strlen(*arrayStep)+strlen(value)+1)*sizeof(char)); 128 sprintf(tmpValueFinal,"%s=%s",*arrayStep,value); 129 tmpMap=createMap("request",tmpValueFinal); 130 free(tmpValueFinal); 131 #ifdef DEBUG 132 fprintf(stderr,"(( \n %s \n %s \n ))",*arrayStep,value); 133 #endif 134 delete[]value; 135 arrayStep++; 136 } 122 137 } 123 138 delete[]buffer; … … 145 160 } 146 161 147 if(strncasecmp(cgiRequestMethod,"post",4)==0 && getMap(tmpMap,"request")==NULL){148 char *tmpKey=strdup(tmpMap->name);149 char *tmpValue=strdup(tmpMap->value);150 freeMap(&tmpMap);151 free(tmpMap);152 char* tmpValueFinal=(char*) malloc((strlen(tmpKey)+strlen(tmpValue)+2)*sizeof(char));153 sprintf(tmpValueFinal,"%s=%s",tmpKey,tmpValue);154 tmpMap=createMap("request",tmpValueFinal);155 free(tmpValueFinal);156 }157 162 /** 158 163 * In case that the POST method was used, then check if params came in XML
Note: See TracChangeset
for help on using the changeset viewer.