Changeset 966 for trunk


Ignore:
Timestamp:
Nov 25, 2020, 4:14:56 PM (4 years ago)
Author:
djay
Message:

Fix issue in kvParseInput when memory!=load and handle session from the OGC API - Processes

Location:
trunk/zoo-project
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/HISTORY.txt

    r962 r966  
    11Version 1.8.0-dev
     2  * Fix issue in kvParseInput when memory!=load and handle session
     3  from the OGC API - Processes
    24  * Update OGC API - Processes documentation
    35  * Add open-api directory in utils services containing a reddis
  • trunk/zoo-project/zoo-kernel/request_parser.c

    r962 r966  
    204204int kvpParseInputs(maps** main_conf,service* s,map *request_inputs,maps** request_output,HINTERNET* hInternet){
    205205  // Parsing inputs provided as KVP
     206  map* memory=getMapFromMaps(*main_conf,"main","memory");
    206207  maps *tmpmaps = *request_output;
    207208  map* r_inputs = getMap (request_inputs, "DataInputs");
     
    342343                  }
    343344                tmpc = strtok (NULL, "@");
     345              }
     346            if(memory!=NULL && strncasecmp(memory->value,"load",4)!=0)
     347              if(getMap(tmpmaps->content,"to_load")==NULL){
     348                addToMap(tmpmaps->content,"to_load","false");
    344349              }
    345350            if (*request_output == NULL)
  • trunk/zoo-project/zoo-kernel/response_print.c

    r962 r966  
    9595    }
    9696  }
     97  printSessionHeaders(m);
     98}
     99
     100/**
     101 * Print the Set-Cookie header if necessary (conf["lenv"]["cookie"]) and save
     102 * the session file.
     103 *
     104 * The session file (sess_<SESSID>_.cfg where <SESSID> is the cookie value) is
     105 * stored in the conf["main"]["tmpPath"] directory.
     106 * @param m the main configuration map
     107 */
     108void printSessionHeaders(maps* m){
     109  maps* tmpSess=getMaps(m,"senv");
     110  if(tmpSess!=NULL){
     111    map *_tmp=getMapFromMaps(m,"lenv","cookie");
     112    maps *tmps=getMaps(m,"senv");
     113    char* sessId=NULL;
     114    if(_tmp!=NULL){
     115      printf("Set-Cookie: %s; HttpOnly\r\n",_tmp->value);
     116      map *_tmp1=getMapFromMaps(m,"senv","ecookie_length");
     117      if(_tmp1!=NULL){
     118        int len=atoi(_tmp1->value);
     119        int cnt=0;
     120        for(cnt=0;cnt<len;cnt++){
     121          map* _tmp2=getMapArray(tmps->content,"ecookie",cnt);
     122          if(_tmp2!=NULL)
     123            printf("Set-Cookie: %s; HttpOnly\r\n",_tmp2->value);
     124        }
     125      }
     126      printf("P3P: CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"\r\n");
     127      char session_file_path[100];
     128      char *tmp1=strtok(_tmp->value,";");
     129      if(tmp1!=NULL)
     130        sprintf(session_file_path,"%s",strstr(tmp1,"=")+1);
     131      else
     132        sprintf(session_file_path,"%s",strstr(_tmp->value,"=")+1);
     133      sessId=zStrdup(session_file_path);
     134    }else{
     135      maps* t=getMaps(m,"senv");
     136      map*p=t->content;
     137      while(p!=NULL){
     138        if(strstr(p->name,"ID")!=NULL){
     139          sessId=zStrdup(p->value);
     140          break;
     141        }
     142        p=p->next;
     143      }
     144    }
     145    char session_file_path[1024];
     146    map *tmpPath=getMapFromMaps(m,"main","sessPath");
     147    if(tmpPath==NULL)
     148      tmpPath=getMapFromMaps(m,"main","tmpPath");
     149    sprintf(session_file_path,"%s/sess_%s.cfg",tmpPath->value,sessId);
     150    FILE* teste=fopen(session_file_path,"w");
     151    if(teste==NULL){
     152      char tmpMsg[1024];
     153      sprintf(tmpMsg,_("Unable to create the file \"%s\" for storing the session maps."),session_file_path);
     154      errorException(m,tmpMsg,"InternalError",NULL);
     155      return;
     156    }
     157    else{
     158      fclose(teste);
     159      dumpMapsToFile(tmpSess,session_file_path,1);
     160    }
     161  } 
    97162}
    98163
     
    26652730  map* version=getMapFromMaps(m,"main","rversion");
    26662731  int vid=getVersionId(version->value);
    2667   maps* tmpSess=getMaps(m,"senv");
    2668   if(tmpSess!=NULL){
    2669     map *_tmp=getMapFromMaps(m,"lenv","cookie");
    2670     maps *tmps=getMaps(m,"senv");
    2671     char* sessId=NULL;
    2672     if(_tmp!=NULL){
    2673       printf("Set-Cookie: %s; HttpOnly\r\n",_tmp->value);
    2674       map *_tmp1=getMapFromMaps(m,"senv","ecookie_length");
    2675       if(_tmp1!=NULL){
    2676         int len=atoi(_tmp1->value);
    2677         int cnt=0;
    2678         for(cnt=0;cnt<len;cnt++){
    2679           map* _tmp2=getMapArray(tmps->content,"ecookie",cnt);
    2680           if(_tmp2!=NULL)
    2681             printf("Set-Cookie: %s; HttpOnly\r\n",_tmp2->value);
    2682         }
    2683       }
    2684       printf("P3P: CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"\r\n");
    2685       char session_file_path[100];
    2686       char *tmp1=strtok(_tmp->value,";");
    2687       if(tmp1!=NULL)
    2688         sprintf(session_file_path,"%s",strstr(tmp1,"=")+1);
    2689       else
    2690         sprintf(session_file_path,"%s",strstr(_tmp->value,"=")+1);
    2691       sessId=zStrdup(session_file_path);
    2692     }else{
    2693       maps* t=getMaps(m,"senv");
    2694       map*p=t->content;
    2695       while(p!=NULL){
    2696         if(strstr(p->name,"ID")!=NULL){
    2697           sessId=zStrdup(p->value);
    2698           break;
    2699         }
    2700         p=p->next;
    2701       }
    2702     }
    2703     char session_file_path[1024];
    2704     map *tmpPath=getMapFromMaps(m,"main","sessPath");
    2705     if(tmpPath==NULL)
    2706       tmpPath=getMapFromMaps(m,"main","tmpPath");
    2707     sprintf(session_file_path,"%s/sess_%s.cfg",tmpPath->value,sessId);
    2708     FILE* teste=fopen(session_file_path,"w");
    2709     if(teste==NULL){
    2710       char tmpMsg[1024];
    2711       sprintf(tmpMsg,_("Unable to create the file \"%s\" for storing the session maps."),session_file_path);
    2712       errorException(m,tmpMsg,"InternalError",NULL);
    2713       return;
    2714     }
    2715     else{
    2716       fclose(teste);
    2717       dumpMapsToFile(tmpSess,session_file_path,1);
    2718     }
    2719   }
     2732  printSessionHeaders(m);
    27202733  if(res==SERVICE_FAILED){
    27212734    char* tmp0=produceErrorMessage(m);
  • trunk/zoo-project/zoo-kernel/response_print.h

    r949 r966  
    197197
    198198  void printHeaders(maps*);
     199  void printSessionHeaders(maps*);
    199200
    200201  int zooXmlSearchForNs(const char*);
  • trunk/zoo-project/zoo-kernel/zoo_service_loader.c

    r962 r966  
    19501950        "/","/api","/conformance","/processes"
    19511951      };
    1952       map* tmpUrl=getMapFromMaps(m,"main","serverAddress");
     1952      map* tmpUrl=getMapFromMaps(m,"openapi","rootUrl");
    19531953      for(int kk=0;kk<4;kk++){
    19541954        maps* tmpMaps=getMaps(m,urls[kk]);
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