Changeset 379 for trunk


Ignore:
Timestamp:
Dec 23, 2012, 11:50:33 AM (11 years ago)
Author:
djay
Message:

Fix handling of multiple outputs. Small fix to build with bleeding edge gcc. Add missing copyright in service_internal_ms.c/h. Better gesture of session data. Update HISTORY.txt content.

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/thirds/cgic206/cgic.c

    r364 r379  
    2323#define CGICDEBUGEND
    2424#endif /* CGICDEBUG */
     25
     26#ifdef WIN32
     27#define _INC_STDIO
     28#endif
    2529
    2630#include <stdio.h>
  • trunk/thirds/dirent-win32/dirent.h

    r348 r379  
    11#ifndef DIRENT_INCLUDED
    2 #define DIRENT_INCLUDED
     2#define DIRENT_INCLUDED 1
    33
    44/*
  • trunk/zoo-project/HISTORY.txt

    r360 r379  
    99  * Add importScripts function to JavaScript support (ticket #66)
    1010  * Add multiple inputs values for the same identifier (ticket #72)
     11  * Add Python ZOO-API to access ZOO-Kernel internel functions
     12  * Add a [headers] section in main.cfg file to add specifics to header returned
     13  * Add support for multiple outputs
    1114
    1215Version 1.2.0-rc3
  • trunk/zoo-project/zoo-kernel/service.h

    r375 r379  
    3333#ifndef snprintf
    3434#define snprintf sprintf_s
     35#else
     36
    3537#endif
    3638#endif
     
    4951#define true 1
    5052#define false -1
     53#else
     54  //#include <stdbool.h>
    5155#endif
    5256
     
    614618      sprintf(tmp,"%s_%d",key,index);
    615619    else
    616       sprintf(tmp,key);
     620      sprintf(tmp,"%s",key);
    617621#ifdef DEBUG
    618622    fprintf(stderr,"** KEY %s\n",tmp);
     
    632636      sprintf(tmp,"%s_%d",key,index);
    633637    else
    634       sprintf(tmp,key);
     638      sprintf(tmp,"%s",key);
    635639    map* tmpSize=getMapArray(m,"size",index);
    636640    if(tmpSize!=NULL && strncasecmp(key,"value",5)==0){
  • trunk/zoo-project/zoo-kernel/service_conf.y

    r226 r379  
    151151: INFCAR ID Attributeetoile SUPCAR
    152152{
     153#ifdef DEBUG_SERVICE_CONF
     154  fprintf(stderr,"(%s %d) %s\n",__FILE__,__LINE__,$2);
     155  fflush(stderr);
     156#endif
    153157  if(my_service->content==NULL){
    154158#ifdef DEBUG_SERVICE_CONF
     
    226230#ifdef DEBUG_SERVICE_CONF
    227231        fprintf(stderr,"(DATAOUTPUTS - %d) ALLOCATE current_element (%s)\n",__LINE__,$2);
     232        fflush(stderr);
    228233#endif
    229234        current_element=(elements*)malloc(ELEMENTS_SIZE);
     
    272277          if(wait_metadata==true){
    273278            if(current_content!=NULL){
     279#ifdef DEBUG_SERVICE_CONF
     280              fprintf(stderr,"add current_content to current_element->content\n");
     281              fprintf(stderr,"LINE %d",__LINE__);
     282#endif
    274283              addMapToMap(&current_element->metadata,current_content);
    275284              current_element->next=NULL;
     
    290299            current_element->next=NULL;
    291300            if($2!=NULL)
    292             current_element->format=strdup($2);
     301              current_element->format=strdup($2);
    293302            current_element->defaults=NULL;
    294303            current_element->supported=NULL;
     
    312321#ifdef DEBUG_SERVICE_CONF
    313322  printf("* Identifiant : %s\n",$2);
     323  fflush(stdout);
    314324#endif
    315325}
     
    357367EmptyElemTag
    358368 : INFCAR ID Attributeetoile SLASH SUPCAR       {
     369#ifdef DEBUG_SERVICE_CONF
     370  fprintf(stderr,"(%s %d)\n",__FILE__,__LINE__);
     371#endif
    359372   if(strncasecmp($2,"Default",7)==0){
    360373     wait_defaults=false;
     
    386399 : INFCAR SLASH ID SUPCAR
    387400{
     401#ifdef DEBUG_SERVICE_CONF
     402  fprintf(stderr,"(%s %d)\n",__FILE__,__LINE__);
     403#endif
    388404  if(strcmp($3,"DataInputs")==0){
    389405    current_data=1;
     
    495511| EPAIR {
    496512#ifdef DEBUG_SERVICE_CONF
     513  fprintf(stderr,"(%s %d)\n",__FILE__,__LINE__);
    497514  fprintf(stderr,"EPAIR FOUND !! \n");
    498515  fprintf(stderr,"[%s=>%s]\n",curr_key,$1);
     
    510527      fprintf(stderr,"[ZOO: service_conf.y line %d free(%s)]\n",__LINE__,curr_key);
    511528#endif
    512       //current_content->next=NULL;
    513529    }
    514530    else{
     
    524540  }
    525541#ifdef DEBUG_SERVICE_CONF
    526   fprintf(stderr,"EPAIR FOUND !! \n");
    527542  fprintf(stderr,"[%s=>%s]\n",curr_key,$1);
    528543  fprintf(stderr,"[ZOO: service_conf.y line %d free(%s)]\n",__LINE__,curr_key);
     544  dumpMap(current_content);
    529545  fflush(stderr);
    530546#endif
     
    540556processid
    541557: ANID  {
     558#ifdef DEBUG_SERVICE_CONF
     559  fprintf(stderr,"(%s %d)\n",__FILE__,__LINE__);
     560#endif
    542561  if(data==-1){
    543562    data=1;
     
    690709            free(current_element);
    691710            current_element=NULL;
     711            current_element=(elements*)malloc(ELEMENTS_SIZE);
     712            char *cen=strdup($1);
     713            current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char));
     714            cen[strlen(cen)-1]=0;
     715            cen+=1;
     716            sprintf(current_element->name,"%s",cen);
     717            cen-=1;
     718            free(cen);
     719            current_element->content=NULL;
     720            current_element->metadata=NULL;
     721            current_element->format=NULL;
     722            current_element->defaults=NULL;
     723            current_element->supported=NULL;
     724            current_element->next=NULL;
    692725          }
    693726          else{
    694727#ifdef DEBUG_SERVICE_CONF
    695728            fprintf(stderr,"NAME OUT %s\n",$1);
    696             fprintf(stderr,"(DATAOUTPUTS - 545) SET NAME OF current_element\n");
     729            fprintf(stderr,"(DATAOUTPUTS - %d) SET NAME OF current_element %s\n",__LINE__,$1);
    697730#endif
    698731            if($1!=NULL){
    699732              char *cen=strdup($1);
    700               current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char*));
     733              current_element->name=(char*)malloc((strlen(cen))*sizeof(char*));
    701734              cen[strlen(cen)-1]=0;
    702735#ifdef DEBUG
  • trunk/zoo-project/zoo-kernel/service_internal.c

    r378 r379  
    13471347    maps* mcursor=outputs;
    13481348    elements* scursor=serv->outputs;
     1349    map* testResponse=getMap(request,"RawDataOutput");
     1350    if(testResponse==NULL)
     1351      testResponse=getMap(request,"ResponseDocument");
    13491352    while(mcursor!=NULL){
     1353      map* tmp0=getMap(mcursor->content,"inRequest");
    13501354      scursor=getElements(serv->outputs,mcursor->name);
    13511355      if(scursor!=NULL){
    1352         printIOType(doc,nc,ns,ns_ows,ns_xlink,scursor,mcursor,"Output");
     1356        if(testResponse==NULL)
     1357          printIOType(doc,nc,ns,ns_ows,ns_xlink,scursor,mcursor,"Output");
     1358        else
     1359          if(strncmp(tmp0->value,"true",4)==0)
     1360            printIOType(doc,nc,ns,ns_ows,ns_xlink,scursor,mcursor,"Output");
    13531361      }
    13541362      mcursor=mcursor->next;
     
    15991607      map* tmp1=getMap(m->content,"encoding");
    16001608      map* tmp2=getMap(m->content,"mimeType");
    1601       map* toto=getMap(m->content,"value");
     1609      map* tmp3=getMap(m->content,"value");
     1610      int hasValue=1;
     1611      if(tmp3==NULL){
     1612        tmp3=createMap("value","");
     1613        hasValue=-1;
     1614      }
    16021615      if((tmp1!=NULL && strncmp(tmp1->value,"base64",6)==0)
    16031616         || (tmp2!=NULL && (strncmp(tmp2->value,"image/",6)==0 ||
     
    16101623        if(rs==NULL){
    16111624          char tmp1[1024];
    1612           sprintf(tmp1,"%d",strlen(toto->value));
     1625          sprintf(tmp1,"%d",strlen(tmp3->value));
    16131626          rs=createMap("size",tmp1);
    16141627          isSized=false;
    16151628        }
    16161629
    1617         xmlAddChild(nc3,xmlNewText(BAD_CAST base64(toto->value, atoi(rs->value))));
     1630        xmlAddChild(nc3,xmlNewText(BAD_CAST base64(tmp3->value, atoi(rs->value))));
    16181631        if(!isSized){
    16191632          freeMap(&rs);
     
    16241637        if(strncmp(tmp2->value,"text/js",7)==0 ||
    16251638           strncmp(tmp2->value,"application/json",16)==0)
    1626           xmlAddChild(nc3,xmlNewCDataBlock(doc,BAD_CAST toto->value,strlen(toto->value)));
     1639          xmlAddChild(nc3,xmlNewCDataBlock(doc,BAD_CAST tmp3->value,strlen(tmp3->value)));
    16271640        else{
    16281641          if(strncmp(tmp2->value,"text/xml",8)==0 ||
    16291642             strncmp(tmp2->value,"application/vnd.google-earth.kml",32)==0){
    16301643            xmlDocPtr doc =
    1631               xmlParseMemory(toto->value,strlen(toto->value));
     1644              xmlParseMemory(tmp3->value,strlen(tmp3->value));
    16321645            xmlNodePtr ir = xmlDocGetRootElement(doc);
    16331646            xmlAddChild(nc3,ir);
    16341647          }
    16351648          else
    1636             xmlAddChild(nc3,xmlNewText(BAD_CAST toto->value));
     1649            xmlAddChild(nc3,xmlNewText(BAD_CAST tmp3->value));
    16371650        }
    16381651        xmlAddChild(nc2,nc3);
    16391652      }
    16401653      else{
    1641                   xmlAddChild(nc3,xmlNewText(BAD_CAST toto->value));
    1642           }
     1654        xmlAddChild(nc3,xmlNewText(BAD_CAST tmp3->value));
     1655      }
     1656      if(hasValue<0){
     1657        freeMap(&tmp3);
     1658        free(tmp3);
     1659      }
    16431660    }
    16441661  }
     
    18111828    asRaw=1;
    18121829 
    1813   map *_tmp=getMapFromMaps(m,"lenv","cookie");
    1814   map *_tmp1=getMapFromMaps(m,"lenv","sessid");
    1815   if(_tmp!=NULL){
    1816     printf("Set-Cookie: %s\r\n",_tmp->value);
    1817     printf("P3P: CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"\r\n");
    1818     maps *tmpSess=getMaps(m,"senv");
    1819     if(tmpSess!=NULL){
    1820       char session_file_path[1024];
    1821       map *tmpPath=getMapFromMaps(m,"main","sessPath");
    1822       if(tmpPath==NULL)
    1823         tmpPath=getMapFromMaps(m,"main","tmpPath");
     1830  maps* tmpSess=getMaps(m,"senv");
     1831  if(tmpSess!=NULL){
     1832    map *_tmp=getMapFromMaps(m,"lenv","cookie");
     1833    char* sessId;
     1834    if(_tmp!=NULL){
     1835      printf("Set-Cookie: %s\r\n",_tmp->value);
     1836      printf("P3P: CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"\r\n");
     1837      char session_file_path[100];
    18241838      char *tmp1=strtok(_tmp->value,";");
    18251839      if(tmp1!=NULL)
    1826         sprintf(session_file_path,"%s/sess_%s.cfg",tmpPath->value,strstr(tmp1,"=")+1);
     1840        sprintf(session_file_path,"%s",strstr(tmp1,"=")+1);
    18271841      else
    1828         sprintf(session_file_path,"%s/sess_%s.cfg",tmpPath->value,strstr(_tmp->value,"=")+1);
    1829       dumpMapsToFile(tmpSess,session_file_path);
    1830     }
    1831   }
    1832 
     1842        sprintf(session_file_path,"%s",strstr(_tmp->value,"=")+1);
     1843      sessId=strdup(session_file_path);
     1844    }else{
     1845      maps* t=getMaps(m,"senv");
     1846      map*p=t->content;
     1847      while(p!=NULL){
     1848        if(strstr(p->name,"ID")!=NULL){
     1849          sessId=strdup(p->value);
     1850          break;
     1851        }
     1852        p=p->next;
     1853      }
     1854    }
     1855    char session_file_path[1024];
     1856    map *tmpPath=getMapFromMaps(m,"main","sessPath");
     1857    if(tmpPath==NULL)
     1858      tmpPath=getMapFromMaps(m,"main","tmpPath");
     1859    sprintf(session_file_path,"%s/sess_%s.cfg",tmpPath->value,sessId);
     1860    dumpMapsToFile(tmpSess,session_file_path);
     1861  }
     1862 
    18331863  printHeaders(m);
    18341864
     
    24722502    fprintf(stderr,"MD5STR : (%s)\n\n",md5str);
    24732503#endif
    2474     char* fname=(char*)malloc(sizeof(char)*(strlen(tmpM->value)+38));
     2504    char* fname=(char*)malloc(sizeof(char)*(strlen(tmpM->value)+50));
    24752505    sprintf(fname,"%s/%s.zca",tmpM->value,md5str);
    24762506    struct stat f_status;
     
    24952525  char* cached=isInCache(m,url);
    24962526  int fsize;
     2527  int hasF=-1;
    24972528  if(cached!=NULL){
    24982529    struct stat f_status;
    24992530    int s=stat(cached, &f_status);
    25002531    if(s==0){
    2501       fprintf(stderr,"FILE SIZE (%d)\n",f_status.st_size/1024);
    25022532      fcontent=(char*)malloc(sizeof(char)*(f_status.st_size+1));
    25032533      FILE* f=fopen(cached,"rb");
    25042534      fread(fcontent,sizeof(char),f_status.st_size,f);
    25052535      fsize=f_status.st_size;
     2536      hasF=1;
    25062537    }
    25072538  }else{
    25082539    res=InternetOpenUrl(hInternet,url,NULL,0,INTERNET_FLAG_NO_CACHE_WRITE,0);
    2509     fcontent=(char*)calloc((res.nDataLen+1),sizeof(char));
     2540    fcontent=(char*)malloc((res.nDataLen+1)*sizeof(char));
    25102541    if(fcontent == NULL){
    25112542      return errorException(m, _("Unable to allocate memory."), "InternalError");
    25122543    }
     2544    hasF=1;
    25132545    size_t dwRead;
    25142546    InternetReadFile(res, (LPVOID)fcontent, res.nDataLen, &dwRead);
     
    25242556  free(tmpMap->value);
    25252557  tmpMap->value=(char*)malloc((fsize+1)*sizeof(char));
     2558  if(tmpMap->value==NULL)
     2559    fprintf(stderr,"Unable to allocate memory!\n");
    25262560  memcpy(tmpMap->value,fcontent,(fsize)*sizeof(char));
    2527 
     2561 
    25282562  char ltmp1[256];
    25292563  sprintf(ltmp1,"%d",fsize);
     
    25312565  if(cached==NULL)
    25322566    addToCache(m,url,fcontent,fsize);
    2533   free(fcontent);
    2534   if(cached!=NULL)
     2567  else{
     2568    if(hasF)
     2569      free(fcontent);
    25352570    free(cached);
     2571  }
    25362572  return 0;
    25372573}
  • trunk/zoo-project/zoo-kernel/service_internal_ms.c

    r370 r379  
     1/**
     2 * Author : Gérald FENOY
     3 *
     4 *  Copyright 2010-2011 Fondazione Edmund Mach. All rights reserved.
     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
    125#ifdef USE_MS
    226#ifndef WIN32
     
    556580    else
    557581      msInsertHashTable(&(myLayer->metadata), "ows_title", "Default Title");
    558 
     582   
    559583    if(msGrowLayerClasses(myLayer) == NULL)
    560584      return -1;
     
    566590    if(initStyle(myLayer->CLASS[myLayer->numclasses]->styles[myLayer->CLASS[myLayer->numclasses]->numstyles]) == -1)
    567591      return -1;
    568 
    569592    /**
    570593     * Apply msStyle else fallback to the default style
     
    583606      myLayer->CLASS[myLayer->numclasses]->styles[myLayer->CLASS[myLayer->numclasses]->numstyles]->outlinecolor.green=80;
    584607      myLayer->CLASS[myLayer->numclasses]->styles[myLayer->CLASS[myLayer->numclasses]->numstyles]->outlinecolor.blue=80;
    585 
     608     
    586609      /**
    587610       * Set specific style depending on type
     
    597620        myLayer->CLASS[myLayer->numclasses]->styles[myLayer->CLASS[myLayer->numclasses]->numstyles]->size=15;
    598621      }
    599 
     622     
    600623    }
    601624    myLayer->CLASS[myLayer->numclasses]->numstyles++;
    602625    myLayer->numclasses++;
     626   
    603627    m->layerorder[m->numlayers] = m->numlayers;
    604628    m->numlayers++;
  • trunk/zoo-project/zoo-kernel/service_internal_ms.h

    r364 r379  
     1/**
     2 * Author : Gérald FENOY
     3 *
     4 *  Copyright 2010  Fondazione Edmund Mach. All rights reserved.
     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 */
    124#ifndef ZOO_SERVICE_INTERNAL_MS_H
    225#define ZOO_SERVICE_INTERNAL_MS_H 1
  • trunk/zoo-project/zoo-kernel/zoo_service_loader.c

    r376 r379  
    775775        memset(buff1,0,1024);
    776776#ifdef DEBUG
    777         fprintf(stderr,"\n#######%s\n########\n",buff1);
     777        printf("\n#######%s\n########\n",buff1);
    778778#endif
    779779        while ((dp = readdir(dirp)) != NULL)
     
    784784            s1=(service*)calloc(1,SERVICE_SIZE);
    785785            if(s1 == NULL){
     786              dup2(saved_stdout,fileno(stdout));
    786787              return errorException(m, _("Unable to allocate memory."),"InternalError");
    787788            }
    788789#ifdef DEBUG
    789             fprintf(stderr,"#################\n%s\n#################\n",buff1);
     790            printf("#################\n%s\n#################\n",buff1);
    790791#endif
    791792            t=getServiceFromFile(buff1,&s1);
     
    13251326                  if(!(ltmp!=NULL && strcmp(ltmp->value,"POST")==0)
    13261327                     && CHECK_INET_HANDLE(hInternet)){
    1327                     if(loadRemoteFile(m,tmpmaps->content,hInternet,(char*)val)){
     1328                    if(loadRemoteFile(m,tmpmaps->content,hInternet,(char*)val)!=0){
    13281329                      freeMaps(&m);
    13291330                      free(m);
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