Changeset 99


Ignore:
Timestamp:
Jan 30, 2011, 7:41:13 PM (13 years ago)
Author:
djay
Message:

Add the correct behavior when method is POST, post-treatment became obsolete.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-kernel/zoo_loader.c

    r95 r99  
    110110  map* tmpMap=NULL;
    111111
    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){
    114114    char *buffer=new char[cgiContentLength+1];
    115115    if(fread(buffer,1,cgiContentLength,cgiIn)){
     
    117117      tmpMap=createMap("request",buffer);
    118118    }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      }
    122137    }
    123138    delete[]buffer;
     
    145160  }
    146161
    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   }
    157162  /**
    158163   * 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.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png