Ignore:
Timestamp:
Dec 28, 2012, 12:41:25 AM (11 years ago)
Author:
djay
Message:

Fix issue when passing Inputs Reference in POST request.

Location:
trunk/zoo-project/zoo-kernel
Files:
2 edited

Legend:

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

    r380 r381  
    8383#endif
    8484
    85   char *strQuery=strdup(cgiQueryString);
     85 
     86  char *strQuery=NULL;
     87  if(cgiQueryString!=NULL)
     88    strQuery=strdup(cgiQueryString);
    8689  map* tmpMap=NULL;
    8790
     
    9396       char *res=NULL;
    9497       int r=0;
    95        while(r=fread(buffer,sizeof(char),1,cgiIn)){
     98       while((r=fread(buffer,sizeof(char),1,cgiIn))){
    9699         cgiContentLength+=r;
    97100         if(res==NULL){
     
    115118      char *buffer=new char[cgiContentLength+1];
    116119      int r=0;
    117       if((r=fread(buffer,sizeof(char),cgiContentLength,cgiIn))!=0){
     120      if(fread(buffer,sizeof(char),cgiContentLength,cgiIn)>=0){
    118121        buffer[cgiContentLength]=0;
    119122        tmpMap=createMap("request",buffer);
     
    196199      xmlDocPtr doc = xmlParseMemory(t1->value,cgiContentLength);
    197200
    198 
    199201      {
    200202        xmlXPathObjectPtr reqptr=extractFromDoc(doc,"/*[local-name()='Envelope']/*[local-name()='Body']/*");
     
    244246          xmlXPathFreeObject(reqptr);
    245247        }
    246         //xmlFree(req);
    247248      }
    248249      if(strncasecmp(t1->value,"GetCapabilities",15)==0){
     
    252253        addToMap(tmpMap,"version",(char*)content);
    253254        xmlXPathFreeObject(versptr);
    254         //xmlFree(vers);
    255255        xmlFree(content);
    256256      }else{
     
    259259        if(tval!=NULL)
    260260          addToMap(tmpMap,"version",tval);
    261         xmlFree(tval);
    262261        tval = (char*) xmlGetProp(cur,BAD_CAST "language");
    263262        if(tval!=NULL)
     
    287286          }
    288287        }
    289         //xmlFree(id);
    290       }
    291       xmlFree(tval);
     288      }
    292289      xmlFreeDoc(doc);
    293290      xmlCleanupParser();
     
    329326  }
    330327
     328  if(strQuery!=NULL)
     329    free(strQuery);
    331330  runRequest(tmpMap);
    332331
  • trunk/zoo-project/zoo-kernel/zoo_service_loader.c

    r380 r381  
    522522   * Parsing service specfic configuration file
    523523   */
    524   m=(maps*)calloc(1,MAPS_SIZE);
     524  m=(maps*)malloc(MAPS_SIZE);
    525525  if(m == NULL){
    526526    return errorException(m, _("Unable to allocate memory."), "InternalError");
     
    533533#endif
    534534  r_inputs=getMapOrFill(request_inputs,"metapath","");
     535
    535536
    536537  char conf_file[10240];
     
    551552    bindtextdomain ("zoo-services","/usr/share/locale/");
    552553  }
     554
    553555
    554556  /**
     
    597599  else
    598600    setMapInMaps(m,"main","isSoap","false");
     601
    599602
    600603  /**
     
    698701        memset(tmps1,0,1024);
    699702        snprintf(tmps1,1024,"%s/%s",conf_dir,dp->d_name);
    700         s1=(service*)calloc(1,SERVICE_SIZE);
     703        s1=(service*)malloc(SERVICE_SIZE);
    701704        if(s1 == NULL){
    702705          return errorException(m, _("Unable to allocate memory."),"InternalError");
     
    782785            memset(buff1,0,1024);
    783786            snprintf(buff1,1024,"%s/%s",conf_dir,dp->d_name);
    784             s1=(service*)calloc(1,SERVICE_SIZE);
     787            s1=(service*)malloc(SERVICE_SIZE);
    785788            if(s1 == NULL){
    786789              dup2(saved_stdout,fileno(stdout));
     
    830833 
    831834  s1=NULL;
    832   s1=(service*)calloc(1,SERVICE_SIZE);
     835  s1=(service*)malloc(SERVICE_SIZE);
    833836  if(s1 == NULL){
    834837    freeMaps(&m);
     
    876879  int j;
    877880 
     881
    878882  /**
    879883   * Create the input and output maps data structure
     
    931935#endif
    932936      pToken=strtok(cursor_output,";");
    933       char** outputs_as_text=(char**)calloc(128,sizeof(char*));
     937      char** outputs_as_text=(char**)malloc(128*sizeof(char*));
    934938      if(outputs_as_text == NULL) {
    935939        return errorException(m, _("Unable to allocate memory"), "InternalError");
     
    942946        fprintf(stderr,"***%s***\n",pToken);
    943947#endif
    944         outputs_as_text[i]=(char*)calloc(strlen(pToken)+1,sizeof(char));
     948        outputs_as_text[i]=(char*)malloc((strlen(pToken)+1)*sizeof(char));
    945949        if(outputs_as_text[i] == NULL) {
    946950          return errorException(m, _("Unable to allocate memory"), "InternalError");
     
    959963          if(k==0){
    960964            if(tmp_output==NULL){
    961               tmp_output=(maps*)calloc(1,MAPS_SIZE);
     965              tmp_output=(maps*)malloc(MAPS_SIZE);
    962966              if(tmp_output == NULL){
    963967                return errorException(m, _("Unable to allocate memory."), "InternalError");
     
    10441048    free(tmp1);
    10451049
    1046     char** inputs_as_text=(char**)calloc(100,sizeof(char*));
     1050    char** inputs_as_text=(char**)malloc(100*sizeof(char*));
    10471051    if(inputs_as_text == NULL){
    10481052      return errorException(m, _("Unable to allocate memory."), "InternalError");
     
    10571061      fprintf(stderr,"***%s***\n",pToken);
    10581062#endif
    1059       inputs_as_text[i]=(char*)calloc(strlen(pToken)+1,sizeof(char));
     1063      inputs_as_text[i]=(char*)malloc((strlen(pToken)+1)*sizeof(char));
    10601064      snprintf(inputs_as_text[i],strlen(pToken)+1,"%s",pToken);
    10611065      if(inputs_as_text[i] == NULL){
     
    10901094#endif
    10911095        if(tmpmaps==NULL){
    1092           tmpmaps=(maps*)calloc(1,MAPS_SIZE);
     1096          tmpmaps=(maps*)malloc(MAPS_SIZE);
    10931097          if(tmpmaps == NULL){
    10941098            return errorException(m, _("Unable to allocate memory."), "InternalError");
     
    11241128            tmpn1[strlen(tmpc)]=0;
    11251129            map* lmap=getLastMap(tmpmaps->content);
    1126             char *tmpValue=(char*)calloc((strlen(tmpv)+strlen(tmpc)+1),sizeof(char));
     1130            char *tmpValue=(char*)malloc((strlen(tmpv)+strlen(tmpc)+1)*sizeof(char));
    11271131            sprintf(tmpValue,"%s@%s",tmpv+1,tmpc);
    11281132            free(lmap->value);
     
    12601264            xmlChar *val= xmlNodeListGetString(doc,cur2->xmlChildrenNode,1);
    12611265            if(tmpmaps==NULL){
    1262               tmpmaps=(maps*)calloc(1,MAPS_SIZE);
     1266              tmpmaps=(maps*)malloc(MAPS_SIZE);
    12631267              if(tmpmaps == NULL){
    12641268                return errorException(m, _("Unable to allocate memory."), "InternalError");
     
    12781282              xmlNodeListGetString(doc,cur2->xmlChildrenNode,1);
    12791283            if(tmpmaps==NULL){
    1280               tmpmaps=(maps*)calloc(1,MAPS_SIZE);
     1284              tmpmaps=(maps*)malloc(MAPS_SIZE);
    12811285              if(tmpmaps == NULL){
    12821286                return errorException(m, _("Unable to allocate memory."), "InternalError");
     
    13651369#endif
    13661370                  if(hai==0){
    1367                     key=(char*)calloc((1+strlen((char*)val)),sizeof(char));
     1371                    key=(char*)malloc((1+strlen((char*)val))*sizeof(char));
    13681372                    snprintf(key,1+strlen((char*)val),"%s",(char*)val);
    13691373                  }else{
    1370                     has=(char*)calloc((3+strlen((char*)val)+strlen(key)),sizeof(char));
     1374                    has=(char*)malloc((3+strlen((char*)val)+strlen(key))*sizeof(char));
    13711375                    if(has == NULL){
    13721376                      return errorException(m, _("Unable to allocate memory."), "InternalError");
     
    14171421                    res=InternetOpenUrl(hInternet,btmp->value,tmp,strlen(tmp),
    14181422                                        INTERNET_FLAG_NO_CACHE_WRITE,0);
    1419                     char* tmpContent = (char*)calloc((res.nDataLen+1),sizeof(char));
     1423                    char* tmpContent = (char*)malloc((res.nDataLen+1)*sizeof(char));
    14201424                    if(tmpContent == NULL){
    14211425                      return errorException(m, _("Unable to allocate memory."), "InternalError");
     
    14521456                                         INTERNET_FLAG_NO_CACHE_WRITE,0);
    14531457                    char* tmp=
    1454                       (char*)calloc((res1.nDataLen+1),sizeof(char));
     1458                      (char*)malloc((res1.nDataLen+1)*sizeof(char));
    14551459                    if(tmp == NULL){
    14561460                      return errorException(m, _("Unable to allocate memory."), "InternalError");
     
    14701474                                          strlen(tmp),
    14711475                                          INTERNET_FLAG_NO_CACHE_WRITE,0);
    1472                       char* tmpContent = (char*)calloc((res.nDataLen+1),sizeof(char));
     1476                      char* tmpContent = (char*)malloc((res.nDataLen+1)*sizeof(char));
    14731477                      if(tmpContent == NULL){
    14741478                        return errorException(m, _("Unable to allocate memory."), "InternalError");
     
    16881692         */
    16891693        if(tmpmaps==NULL){
    1690           tmpmaps=(maps*)calloc(1,MAPS_SIZE);
     1694          tmpmaps=(maps*)malloc(MAPS_SIZE);
    16911695          if(tmpmaps == NULL){
    16921696            return errorException(m, _("Unable to allocate memory."), "InternalError");
    16931697          }
    16941698          tmpmaps->name=strdup("unknownIdentifier");
     1699          tmpmaps->content=NULL;
    16951700          tmpmaps->next=NULL;
    16961701        }
     
    17191724        }
    17201725        xmlNodePtr cur1=cur->children;
     1726        while(cur1!=NULL && cur1->type != XML_ELEMENT_NODE)
     1727          cur1=cur1->next;
    17211728        while(cur1){
    17221729          /**
     
    17271734              xmlNodeListGetString(doc,cur1->xmlChildrenNode,1);
    17281735            if(tmpmaps==NULL){
    1729               tmpmaps=(maps*)calloc(1,MAPS_SIZE);
     1736              tmpmaps=(maps*)malloc(MAPS_SIZE);
    17301737              if(tmpmaps == NULL){
    17311738                return errorException(m, _("Unable to allocate memory."), "InternalError");
     
    17471754              xmlNodeListGetString(doc,cur1->xmlChildrenNode,1);
    17481755            if(tmpmaps==NULL){
    1749               tmpmaps=(maps*)calloc(1,MAPS_SIZE);
     1756              tmpmaps=(maps*)malloc(MAPS_SIZE);
    17501757              if(tmpmaps == NULL){
    17511758                return errorException(m, _("Unable to allocate memory."), "InternalError");
     
    17871794              xmlFree(val);
    17881795            }
    1789            
    17901796            xmlNodePtr cur2=cur1->children;
    17911797            while(cur2){
     
    17971803                  xmlNodeListGetString(doc,cur2->xmlChildrenNode,1);
    17981804                if(tmpmaps==NULL){
    1799                   tmpmaps=(maps*)calloc(1,MAPS_SIZE);
     1805                  tmpmaps=(maps*)malloc(MAPS_SIZE);
    18001806                  if(tmpmaps == NULL){
    18011807                    return errorException(m, _("Unable to allocate memory."), "InternalError");
     
    18201826                  xmlNodeListGetString(doc,cur2->xmlChildrenNode,1);
    18211827                if(tmpmaps==NULL){
    1822                   tmpmaps=(maps*)calloc(1,MAPS_SIZE);
     1828                  tmpmaps=(maps*)malloc(MAPS_SIZE);
    18231829                  if(tmpmaps == NULL){
    18241830                    return errorException(m, _("Unable to allocate memory."), "InternalError");
     
    18581864      }
    18591865    }
    1860 
    18611866    xmlXPathFreeObject(tmpsptr);
    18621867    xmlCleanupParser();
     
    20962101      sprintf(session_file_path,"%s/sess_%s.cfg",tmpPath->value,strstr(cgiCookie,"=")+1);
    20972102    free(tcook);
    2098     maps *tmpSess=(maps*)calloc(1,MAPS_SIZE);
     2103    maps *tmpSess=(maps*)malloc(MAPS_SIZE);
    20992104    struct stat file_status;
    21002105    int istat = stat(session_file_path, &file_status);
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