[607] | 1 | /* |
---|
[1] | 2 | * Author : Gérald FENOY |
---|
| 3 | * |
---|
[69] | 4 | * Copyright 2008-2011 GeoLabs SARL. All rights reserved. |
---|
[1] | 5 | * |
---|
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
---|
| 7 | * of this software and associated documentation files (the "Software"), to deal |
---|
| 8 | * in the Software without restriction, including without limitation the rights |
---|
| 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
---|
| 10 | * copies of the Software, and to permit persons to whom the Software is |
---|
| 11 | * furnished to do so, subject to the following conditions: |
---|
| 12 | * |
---|
| 13 | * The above copyright notice and this permission notice shall be included in |
---|
| 14 | * all copies or substantial portions of the Software. |
---|
| 15 | * |
---|
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
---|
| 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
---|
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
---|
| 22 | * THE SOFTWARE. |
---|
| 23 | */ |
---|
| 24 | |
---|
[9] | 25 | #define MALLOC_CHECK_ 0 |
---|
| 26 | #define MALLOC_CHECK 0 |
---|
| 27 | |
---|
[1] | 28 | /** |
---|
| 29 | * Specific includes |
---|
| 30 | */ |
---|
| 31 | #include "fcgio.h" |
---|
| 32 | #include "fcgi_config.h" |
---|
| 33 | #include "fcgi_stdio.h" |
---|
| 34 | #include <sys/types.h> |
---|
| 35 | #include <unistd.h> |
---|
[9] | 36 | #include "service_internal.h" |
---|
[640] | 37 | #include "response_print.h" |
---|
[554] | 38 | |
---|
[1] | 39 | extern "C" { |
---|
| 40 | #include "cgic.h" |
---|
| 41 | #include <libxml/tree.h> |
---|
| 42 | #include <libxml/xmlmemory.h> |
---|
| 43 | #include <libxml/parser.h> |
---|
| 44 | #include <libxml/xpath.h> |
---|
| 45 | #include <libxml/xpathInternals.h> |
---|
| 46 | } |
---|
| 47 | |
---|
[682] | 48 | #ifdef WIN32 |
---|
| 49 | #include "windows.h" |
---|
| 50 | #define strtok_r strtok_s |
---|
| 51 | #endif |
---|
| 52 | |
---|
[280] | 53 | #include "service_internal.h" |
---|
[621] | 54 | #include "request_parser.h" |
---|
[280] | 55 | |
---|
[490] | 56 | int runRequest(map**); |
---|
[9] | 57 | |
---|
| 58 | using namespace std; |
---|
| 59 | |
---|
[364] | 60 | #ifndef TRUE |
---|
[9] | 61 | #define TRUE 1 |
---|
[364] | 62 | #endif |
---|
| 63 | #ifndef FALSE |
---|
[1] | 64 | #define FALSE -1 |
---|
[364] | 65 | #endif |
---|
[1] | 66 | |
---|
[835] | 67 | #ifdef WIN32 |
---|
| 68 | extern "C" |
---|
| 69 | { |
---|
| 70 | __declspec (dllexport) char *strcasestr (char const *a, char const *b) |
---|
| 71 | #ifndef USE_MS |
---|
| 72 | { |
---|
| 73 | char *x = zStrdup (a); |
---|
| 74 | char *y = zStrdup (b); |
---|
| 75 | |
---|
| 76 | x = _strlwr (x); |
---|
| 77 | y = _strlwr (y); |
---|
| 78 | char *pos = strstr (x, y); |
---|
| 79 | char *ret = pos == NULL ? NULL : (char *) (a + (pos - x)); |
---|
| 80 | free (x); |
---|
| 81 | free (y); |
---|
| 82 | return ret; |
---|
| 83 | }; |
---|
| 84 | #else |
---|
| 85 | ; |
---|
| 86 | #endif |
---|
| 87 | } |
---|
| 88 | #endif |
---|
| 89 | |
---|
[607] | 90 | /** |
---|
| 91 | * Main entry point for cgic. |
---|
| 92 | * @return 0 on sucess. |
---|
| 93 | */ |
---|
[1] | 94 | int cgiMain(){ |
---|
| 95 | /** |
---|
| 96 | * We'll use cgiOut as the default output (stdout) to produce plain text |
---|
| 97 | * response. |
---|
| 98 | */ |
---|
| 99 | dup2(fileno(cgiOut),fileno(stdout)); |
---|
| 100 | #ifdef DEBUG |
---|
[9] | 101 | fprintf(cgiOut,"Content-Type: text/plain; charset=utf-8\r\nStatus: 200 OK\r\n\r\n"); |
---|
| 102 | fprintf(cgiOut,"Welcome on ZOO verbose debuging mode \r\n\r\n"); |
---|
| 103 | fflush(cgiOut); |
---|
| 104 | fprintf (stderr, "Addr:%s\n", cgiRemoteAddr); |
---|
[280] | 105 | fprintf (stderr, "RequestMethod: (%s) %d %d\n", cgiRequestMethod,strncasecmp(cgiRequestMethod,"post",4),strncmp(cgiContentType,"text/xml",8)==0 || strncasecmp(cgiRequestMethod,"post",4)==0); |
---|
[9] | 106 | fprintf (stderr, "Request: %s\n", cgiQueryString); |
---|
[380] | 107 | fprintf (stderr, "ContentType: %s\n", cgiContentType); |
---|
| 108 | fprintf (stderr, "ContentLength: %d\n", cgiContentLength); |
---|
[376] | 109 | fflush(stderr); |
---|
[1] | 110 | #endif |
---|
[381] | 111 | |
---|
| 112 | char *strQuery=NULL; |
---|
| 113 | if(cgiQueryString!=NULL) |
---|
[453] | 114 | strQuery=zStrdup(cgiQueryString); |
---|
[9] | 115 | map* tmpMap=NULL; |
---|
[69] | 116 | |
---|
[99] | 117 | if(strncmp(cgiContentType,"text/xml",8)==0 || |
---|
| 118 | strncasecmp(cgiRequestMethod,"post",4)==0){ |
---|
[490] | 119 | if(cgiContentLength==0){ |
---|
[790] | 120 | |
---|
[280] | 121 | char *buffer=new char[2]; |
---|
| 122 | char *res=NULL; |
---|
| 123 | int r=0; |
---|
[381] | 124 | while((r=fread(buffer,sizeof(char),1,cgiIn))){ |
---|
[490] | 125 | buffer[1]=0; |
---|
[280] | 126 | if(res==NULL){ |
---|
[490] | 127 | res=(char*)malloc(2*sizeof(char)); |
---|
[280] | 128 | sprintf(res,"%s",buffer); |
---|
| 129 | } |
---|
| 130 | else{ |
---|
[510] | 131 | res=(char*)realloc(res,(cgiContentLength+2)*sizeof(char)); |
---|
| 132 | memcpy(res + cgiContentLength, buffer, sizeof(char)); |
---|
| 133 | res[cgiContentLength+1]=0; |
---|
[280] | 134 | } |
---|
[510] | 135 | cgiContentLength+=r; |
---|
[280] | 136 | } |
---|
[490] | 137 | delete[] buffer; |
---|
[674] | 138 | if(res!=NULL && (strQuery==NULL || strlen(strQuery)==0)) |
---|
| 139 | tmpMap=createMap("request",res); |
---|
[490] | 140 | if(res!=NULL) |
---|
| 141 | free(res); |
---|
[1] | 142 | }else{ |
---|
[280] | 143 | char *buffer=new char[cgiContentLength+1]; |
---|
[490] | 144 | if(fread(buffer,sizeof(char),cgiContentLength,cgiIn)>0){ |
---|
[280] | 145 | buffer[cgiContentLength]=0; |
---|
| 146 | tmpMap=createMap("request",buffer); |
---|
| 147 | }else{ |
---|
| 148 | buffer[0]=0; |
---|
| 149 | char **array, **arrayStep; |
---|
| 150 | if (cgiFormEntries(&array) != cgiFormSuccess) { |
---|
| 151 | return 1; |
---|
| 152 | } |
---|
| 153 | arrayStep = array; |
---|
| 154 | while (*arrayStep) { |
---|
| 155 | char *ivalue=new char[cgiContentLength]; |
---|
| 156 | cgiFormStringNoNewlines(*arrayStep, ivalue, cgiContentLength); |
---|
[601] | 157 | char* tmpValueFinal=(char*) malloc((strlen(*arrayStep)+strlen(ivalue)+2)*sizeof(char)); |
---|
[280] | 158 | sprintf(tmpValueFinal,"%s=%s",*arrayStep,ivalue); |
---|
[601] | 159 | |
---|
| 160 | if(strlen(buffer)==0){ |
---|
[280] | 161 | sprintf(buffer,"%s",tmpValueFinal); |
---|
[601] | 162 | }else{ |
---|
[453] | 163 | char *tmp=zStrdup(buffer); |
---|
[280] | 164 | sprintf(buffer,"%s&%s",tmp,tmpValueFinal); |
---|
| 165 | free(tmp); |
---|
[601] | 166 | } |
---|
[280] | 167 | free(tmpValueFinal); |
---|
[99] | 168 | #ifdef DEBUG |
---|
[280] | 169 | fprintf(stderr,"(( \n %s \n %s \n ))",*arrayStep,ivalue); |
---|
[99] | 170 | #endif |
---|
[280] | 171 | delete[]ivalue; |
---|
| 172 | arrayStep++; |
---|
[601] | 173 | } |
---|
[490] | 174 | if(tmpMap!=NULL) |
---|
| 175 | addToMap(tmpMap,"request",buffer); |
---|
| 176 | else |
---|
| 177 | tmpMap=createMap("request",buffer); |
---|
[99] | 178 | } |
---|
[280] | 179 | delete[]buffer; |
---|
[601] | 180 | } |
---|
[1] | 181 | } |
---|
| 182 | else{ |
---|
[364] | 183 | #ifdef DEBUG |
---|
[331] | 184 | dumpMap(tmpMap); |
---|
[364] | 185 | #endif |
---|
[1] | 186 | char **array, **arrayStep; |
---|
| 187 | if (cgiFormEntries(&array) != cgiFormSuccess) { |
---|
| 188 | return 1; |
---|
| 189 | } |
---|
| 190 | arrayStep = array; |
---|
| 191 | while (*arrayStep) { |
---|
| 192 | char *value=new char[cgiContentLength]; |
---|
| 193 | cgiFormStringNoNewlines(*arrayStep, value, cgiContentLength); |
---|
| 194 | #ifdef DEBUG |
---|
| 195 | fprintf(stderr,"(( \n %s \n %s \n ))",*arrayStep,value); |
---|
| 196 | #endif |
---|
[9] | 197 | if(tmpMap!=NULL) |
---|
[587] | 198 | addToMap(tmpMap,*arrayStep,value); |
---|
[1] | 199 | else |
---|
[587] | 200 | tmpMap=createMap(*arrayStep,value); |
---|
[1] | 201 | arrayStep++; |
---|
[9] | 202 | delete[]value; |
---|
[1] | 203 | } |
---|
| 204 | cgiStringArrayFree(array); |
---|
| 205 | } |
---|
| 206 | |
---|
[458] | 207 | #ifdef WIN32 |
---|
| 208 | map *tmpReq=getMap(tmpMap,"rfile"); |
---|
| 209 | if(tmpReq!=NULL){ |
---|
| 210 | FILE *lf=fopen(tmpReq->value,"r"); |
---|
| 211 | fseek(lf,0,SEEK_END); |
---|
| 212 | long flen=ftell(lf); |
---|
| 213 | fseek(lf,0,SEEK_SET); |
---|
| 214 | char *buffer=(char*)malloc((flen+1)*sizeof(char)); |
---|
| 215 | fread(buffer,flen,1,lf); |
---|
[682] | 216 | char *pchr=strrchr(buffer,'>'); |
---|
| 217 | cgiContentLength=strlen(buffer)-strlen(pchr)+1; |
---|
| 218 | buffer[cgiContentLength]=0; |
---|
[458] | 219 | fclose(lf); |
---|
| 220 | addToMap(tmpMap,"request",buffer); |
---|
| 221 | free(buffer); |
---|
| 222 | } |
---|
| 223 | #endif |
---|
[1] | 224 | /** |
---|
| 225 | * In case that the POST method was used, then check if params came in XML |
---|
[9] | 226 | * format else try to use the attribute "request" which should be the only |
---|
| 227 | * one. |
---|
[1] | 228 | */ |
---|
[10] | 229 | if(strncasecmp(cgiRequestMethod,"post",4)==0 || |
---|
[458] | 230 | (count(tmpMap)==1 && strncmp(tmpMap->value,"<",1)==0) |
---|
| 231 | #ifdef WIN32 |
---|
| 232 | ||tmpReq!=NULL |
---|
| 233 | #endif |
---|
| 234 | ){ |
---|
[1] | 235 | /** |
---|
| 236 | * Store the original XML request in xrequest map |
---|
| 237 | */ |
---|
[9] | 238 | map* t1=getMap(tmpMap,"request"); |
---|
[621] | 239 | if(t1!=NULL && strncasecmp(t1->value,"<",1)==0) { |
---|
[9] | 240 | addToMap(tmpMap,"xrequest",t1->value); |
---|
[1] | 241 | xmlInitParser(); |
---|
[745] | 242 | xmlDocPtr doc = xmlReadMemory(t1->value, cgiContentLength, "input_request.xml", NULL, XML_PARSE_RECOVER); |
---|
[280] | 243 | { |
---|
| 244 | xmlXPathObjectPtr reqptr=extractFromDoc(doc,"/*[local-name()='Envelope']/*[local-name()='Body']/*"); |
---|
| 245 | if(reqptr!=NULL){ |
---|
| 246 | xmlNodeSet* req=reqptr->nodesetval; |
---|
| 247 | if(req!=NULL && req->nodeNr==1){ |
---|
| 248 | addToMap(tmpMap,"soap","true"); |
---|
[465] | 249 | for(int k=0;k < req->nodeNr;k++){ |
---|
[280] | 250 | xmlDocSetRootElement(doc, req->nodeTab[k]); |
---|
| 251 | xmlChar *xmlbuff; |
---|
| 252 | int buffersize; |
---|
| 253 | xmlDocDumpFormatMemoryEnc(doc, &xmlbuff, &buffersize, "utf-8", 1); |
---|
| 254 | addToMap(tmpMap,"xrequest",(char*)xmlbuff); |
---|
| 255 | xmlFree(xmlbuff); |
---|
| 256 | } |
---|
| 257 | } |
---|
[490] | 258 | xmlXPathFreeObject(reqptr); |
---|
[280] | 259 | } |
---|
| 260 | } |
---|
| 261 | |
---|
[1] | 262 | xmlNodePtr cur = xmlDocGetRootElement(doc); |
---|
| 263 | char *tval; |
---|
| 264 | tval=NULL; |
---|
| 265 | tval = (char*) xmlGetProp(cur,BAD_CAST "service"); |
---|
[490] | 266 | if(tval!=NULL){ |
---|
[9] | 267 | addToMap(tmpMap,"service",tval); |
---|
[490] | 268 | xmlFree(tval); |
---|
| 269 | } |
---|
[1] | 270 | tval=NULL; |
---|
| 271 | tval = (char*) xmlGetProp(cur,BAD_CAST "language"); |
---|
[490] | 272 | if(tval!=NULL){ |
---|
[9] | 273 | addToMap(tmpMap,"language",tval); |
---|
[490] | 274 | xmlFree(tval); |
---|
| 275 | } |
---|
[718] | 276 | const char* requests[6]={"GetCapabilities","DescribeProcess","Execute","GetStatus","GetResult","Dismiss"}; |
---|
| 277 | for(int j=0;j<6;j++){ |
---|
[280] | 278 | char tt[128]; |
---|
[1] | 279 | sprintf(tt,"/*[local-name()='%s']",requests[j]); |
---|
[9] | 280 | xmlXPathObjectPtr reqptr=extractFromDoc(doc,tt); |
---|
| 281 | if(reqptr!=NULL){ |
---|
| 282 | xmlNodeSet* req=reqptr->nodesetval; |
---|
[1] | 283 | #ifdef DEBUG |
---|
[9] | 284 | fprintf(stderr,"%i",req->nodeNr); |
---|
[1] | 285 | #endif |
---|
[9] | 286 | if(req!=NULL && req->nodeNr==1){ |
---|
[490] | 287 | if(t1->value!=NULL) |
---|
| 288 | free(t1->value); |
---|
[453] | 289 | t1->value=zStrdup(requests[j]); |
---|
[718] | 290 | j=5; |
---|
[9] | 291 | } |
---|
| 292 | xmlXPathFreeObject(reqptr); |
---|
[1] | 293 | } |
---|
| 294 | } |
---|
[9] | 295 | if(strncasecmp(t1->value,"GetCapabilities",15)==0){ |
---|
| 296 | xmlXPathObjectPtr versptr=extractFromDoc(doc,"/*/*/*[local-name()='Version']"); |
---|
| 297 | xmlNodeSet* vers=versptr->nodesetval; |
---|
[640] | 298 | if(vers!=NULL && vers->nodeTab!=NULL && vers->nodeTab[0]!=NULL){ |
---|
| 299 | xmlChar* content=xmlNodeListGetString(doc, vers->nodeTab[0]->xmlChildrenNode,1); |
---|
| 300 | addToMap(tmpMap,"version",(char*)content); |
---|
| 301 | xmlFree(content); |
---|
| 302 | } |
---|
| 303 | if(cur->ns){ |
---|
| 304 | addToMap(tmpMap,"wps_schemas",(char*)cur->ns->href); |
---|
| 305 | int j=0; |
---|
| 306 | for(j=0;j<2;j++) |
---|
| 307 | if(strncasecmp(schemas[j][2],(char*)cur->ns->href,strlen(schemas[j][2]))==0){ |
---|
| 308 | char vers[6]; |
---|
| 309 | sprintf(vers,"%d.0.0",j+1); |
---|
| 310 | addToMap(tmpMap,"version",(char*)vers); |
---|
| 311 | } |
---|
| 312 | } |
---|
[9] | 313 | xmlXPathFreeObject(versptr); |
---|
[1] | 314 | }else{ |
---|
| 315 | tval=NULL; |
---|
| 316 | tval = (char*) xmlGetProp(cur,BAD_CAST "version"); |
---|
[490] | 317 | if(tval!=NULL){ |
---|
[9] | 318 | addToMap(tmpMap,"version",tval); |
---|
[490] | 319 | xmlFree(tval); |
---|
| 320 | } |
---|
[1] | 321 | tval = (char*) xmlGetProp(cur,BAD_CAST "language"); |
---|
[490] | 322 | if(tval!=NULL){ |
---|
[9] | 323 | addToMap(tmpMap,"language",tval); |
---|
[490] | 324 | xmlFree(tval); |
---|
| 325 | } |
---|
[9] | 326 | xmlXPathObjectPtr idptr=extractFromDoc(doc,"/*/*[local-name()='Identifier']"); |
---|
| 327 | if(idptr!=NULL){ |
---|
| 328 | xmlNodeSet* id=idptr->nodesetval; |
---|
| 329 | if(id!=NULL){ |
---|
| 330 | char* identifiers=NULL; |
---|
| 331 | identifiers=(char*)calloc(cgiContentLength,sizeof(char)); |
---|
| 332 | identifiers[0]=0; |
---|
| 333 | for(int k=0;k<id->nodeNr;k++){ |
---|
| 334 | xmlChar* content=xmlNodeListGetString(doc, id->nodeTab[k]->xmlChildrenNode,1); |
---|
| 335 | if(strlen(identifiers)>0){ |
---|
[453] | 336 | char *tmp=zStrdup(identifiers); |
---|
[9] | 337 | snprintf(identifiers,strlen(tmp)+xmlStrlen(content)+2,"%s,%s",tmp,content); |
---|
| 338 | free(tmp); |
---|
| 339 | } |
---|
| 340 | else{ |
---|
| 341 | snprintf(identifiers,xmlStrlen(content)+1,"%s",content); |
---|
| 342 | } |
---|
| 343 | xmlFree(content); |
---|
| 344 | } |
---|
| 345 | xmlXPathFreeObject(idptr); |
---|
[718] | 346 | if(identifiers[0]!=0) |
---|
| 347 | addToMap(tmpMap,"Identifier",identifiers); |
---|
[9] | 348 | free(identifiers); |
---|
[1] | 349 | } |
---|
[718] | 350 | } |
---|
| 351 | if(getMap(tmpMap,"Identifier")==NULL){ |
---|
[654] | 352 | idptr=extractFromDoc(doc,"/*/*[local-name()='JobID']"); |
---|
| 353 | if(idptr!=NULL){ |
---|
| 354 | xmlNodeSet* id=idptr->nodesetval; |
---|
| 355 | if(id!=NULL){ |
---|
| 356 | char* identifiers=NULL; |
---|
| 357 | identifiers=(char*)calloc(cgiContentLength,sizeof(char)); |
---|
| 358 | identifiers[0]=0; |
---|
| 359 | for(int k=0;k<id->nodeNr;k++){ |
---|
[718] | 360 | xmlChar* content=xmlNodeListGetString(doc, id->nodeTab[k]->xmlChildrenNode,1); |
---|
| 361 | if(strlen(identifiers)>0){ |
---|
| 362 | char *tmp=zStrdup(identifiers); |
---|
| 363 | snprintf(identifiers,strlen(tmp)+xmlStrlen(content)+2,"%s,%s",tmp,content); |
---|
| 364 | free(tmp); |
---|
| 365 | } |
---|
| 366 | else{ |
---|
| 367 | snprintf(identifiers,xmlStrlen(content)+1,"%s",content); |
---|
| 368 | } |
---|
| 369 | xmlFree(content); |
---|
[654] | 370 | } |
---|
| 371 | xmlXPathFreeObject(idptr); |
---|
[718] | 372 | if(identifiers[0]!=0) |
---|
| 373 | addToMap(tmpMap,"JobID",identifiers); |
---|
[654] | 374 | free(identifiers); |
---|
| 375 | } |
---|
[718] | 376 | } |
---|
[1] | 377 | } |
---|
| 378 | } |
---|
[9] | 379 | xmlFreeDoc(doc); |
---|
| 380 | xmlCleanupParser(); |
---|
[331] | 381 | }else{ |
---|
| 382 | freeMap(&tmpMap); |
---|
| 383 | free(tmpMap); |
---|
| 384 | tmpMap=createMap("not_valid","true"); |
---|
[1] | 385 | } |
---|
[329] | 386 | |
---|
| 387 | char *token,*saveptr; |
---|
| 388 | token=strtok_r(cgiQueryString,"&",&saveptr); |
---|
| 389 | while(token!=NULL){ |
---|
| 390 | char *token1,*saveptr1; |
---|
| 391 | char *name=NULL; |
---|
| 392 | char *value=NULL; |
---|
| 393 | token1=strtok_r(token,"=",&saveptr1); |
---|
| 394 | while(token1!=NULL){ |
---|
[587] | 395 | if(name==NULL) |
---|
| 396 | name=zStrdup(token1); |
---|
| 397 | else |
---|
| 398 | value=zStrdup(token1); |
---|
| 399 | token1=strtok_r(NULL,"=",&saveptr1); |
---|
[601] | 400 | } |
---|
[587] | 401 | //addToMap(tmpMap,name,value); |
---|
[682] | 402 | /* knut: strtok(_r) ignores delimiter bytes at start and end of string; |
---|
| 403 | * it will return non-empty string or NULL, e.g. "metapath=" yields value=NULL. |
---|
| 404 | * This modification sets value="" instead of NULL. |
---|
| 405 | */ |
---|
| 406 | addToMap(tmpMap,name, value != NULL ? value : ""); |
---|
[329] | 407 | free(name); |
---|
| 408 | free(value); |
---|
[331] | 409 | name=NULL; |
---|
| 410 | value=NULL; |
---|
[329] | 411 | token=strtok_r(NULL,"&",&saveptr); |
---|
| 412 | } |
---|
[1] | 413 | } |
---|
| 414 | |
---|
[331] | 415 | if(strncasecmp(cgiContentType,"multipart/form-data",19)==0){ |
---|
[376] | 416 | map* tmp=getMap(tmpMap,"dataInputs"); |
---|
| 417 | if(tmp!=NULL){ |
---|
[790] | 418 | if(strcasestr(strQuery,"dataInputs=")!=NULL) |
---|
| 419 | addToMap(tmpMap,"dataInputs",strcasestr(strQuery,"dataInputs=")+11); |
---|
| 420 | else |
---|
| 421 | addToMap(tmpMap,"dataInputs","None"); |
---|
[331] | 422 | } |
---|
[376] | 423 | } |
---|
[331] | 424 | |
---|
[381] | 425 | if(strQuery!=NULL) |
---|
| 426 | free(strQuery); |
---|
[9] | 427 | |
---|
[490] | 428 | runRequest(&tmpMap); |
---|
| 429 | |
---|
[516] | 430 | if(tmpMap!=NULL){ |
---|
[9] | 431 | freeMap(&tmpMap); |
---|
| 432 | free(tmpMap); |
---|
| 433 | } |
---|
[1] | 434 | return 0; |
---|
| 435 | |
---|
| 436 | } |
---|