Ignore:
Timestamp:
Feb 5, 2018, 1:19:13 PM (6 years ago)
Author:
djay
Message:

Change the default ZOO-Kernel behavior, if an input has been passed by reference, the ZOO-Service will receive a cache_file map rather than the value field which was usually returned, same for array value apply. To use the previous behavior, one can add "memory=load" to the main section of the main.cfg file. Update ZOO-Services for using this new field if available.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/prototype-v0/zoo-project/zoo-kernel/ulinet.c

    r862 r863  
    7070
    7171/**
    72  * Write the downloaded content to a _HINTERNET structure
     72 * Write the downloaded content in the file pouted by the _HINTERNET structure
    7373 *
    7474 * @param buffer the buffer to read
     
    8989   psInternet=(_HINTERNET *)data;
    9090   writen+=fwrite(buffer, size, nmemb, psInternet->file);
    91    if(psInternet->nDataLen>0){
    92      psInternet->nDataAlloc+=psInternet->nDataLen+writen+1;
    93      psInternet->nDataLen += realsize;
    94    }else
    95      psInternet->nDataLen=realsize+1;
     91   fflush(psInternet->file);
     92   psInternet->nDataLen += realsize;
     93
    9694   buffer=NULL;
    9795   return realsize;
     
    443441 * @param dwFlags desired download mode (INTERNET_FLAG_NO_CACHE_WRITE for not using cache file)
    444442 * @param dwContext not used
     443 * @param conf the main configuration file maps pointer
    445444 * @return the updated HINTERNET
    446445 */
    447 HINTERNET InternetOpenUrl(HINTERNET* hInternet,LPCTSTR lpszUrl,LPCTSTR lpszHeaders,size_t dwHeadersLength,size_t dwFlags,size_t dwContext){
     446HINTERNET InternetOpenUrl(HINTERNET* hInternet,LPCTSTR lpszUrl,LPCTSTR lpszHeaders,size_t dwHeadersLength,size_t dwFlags,size_t dwContext,const maps* conf){
    448447
    449448  char filename[255];
     449  int ldwFlags=INTERNET_FLAG_NEED_FILE;
    450450  struct MemoryStruct header;
     451  map* memUse=getMapFromMaps(conf,"main","memory");
    451452
    452453  hInternet->ihandle[hInternet->nb].handle=curl_easy_init( );
     
    480481  curl_easy_setopt(hInternet->ihandle[hInternet->nb].handle, CURLOPT_VERBOSE, 1);
    481482#endif
    482      
    483   switch(dwFlags)
     483
     484  if(memUse!=NULL && strcasecmp(memUse->value,"load")==0)
     485    ldwFlags=INTERNET_FLAG_NO_CACHE_WRITE;
     486 
     487  switch(ldwFlags)
    484488    {
    485489    case INTERNET_FLAG_NO_CACHE_WRITE:
     
    491495      memset(filename,0,255);
    492496      char* tmpUuid=get_uuid();
    493       sprintf(filename,"/tmp/ZOO_Cache%s", tmpUuid);
     497      map* tmpPath=NULL;
     498      if(conf!=NULL){
     499        tmpPath=getMapFromMaps(conf,"main","tmpPath");
     500      }
     501      if(tmpPath==NULL)
     502        sprintf(filename,"/tmp/ZOO_Cache%s", tmpUuid);
     503      else
     504        sprintf(filename,"/%s/ZOO_Cache%s", tmpPath->value,tmpUuid);
     505      fprintf(stderr," *** %s %d %s",__FILE__,__LINE__,filename);
     506      fflush(stderr);
    494507      free(tmpUuid);
    495508      hInternet->ihandle[hInternet->nb].filename=strdup(filename);
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