Ignore:
Timestamp:
Jul 11, 2014, 10:14:03 PM (10 years ago)
Author:
djay
Message:

Inputs passed by reference downloaded in parallel. Conform behavior for DescribeProcess? when the Identifier was not found.

File:
1 edited

Legend:

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

    r471 r492  
    732732}
    733733
    734 HINTERNET setHeader(HINTERNET handle,JSContext *cx,JSObject *header){
     734HINTERNET setHeader(HINTERNET* handle,JSContext *cx,JSObject *header){
    735735  jsuint length=0;
    736736  jsint i=0;
     
    747747    fprintf(stderr,"header is an array of %d elements\n",length);
    748748#endif
    749     handle.header=NULL;
     749    handle->ihandle[handle->nb].header=NULL;
    750750    for(i=0;i<length;i++){
    751751      jsval tmp;
     
    753753      tmp1=JSValToChar(cx,&tmp);
    754754#ifdef ULINET_DEBUG
    755       curl_easy_setopt(handle.handle,CURLOPT_VERBOSE,1);
     755      curl_easy_setopt(handle->ihandle[handle->nb].handle,CURLOPT_VERBOSE,1);
    756756      fprintf(stderr,"Element of array n° %d, value : %s\n",i,tmp1);
    757757#endif
    758       handle.header=curl_slist_append(handle.header, tmp1);
     758      handle->ihandle[handle->nb].header=curl_slist_append(handle->ihandle[handle->nb].header, tmp1);
    759759      free(tmp1);
    760760    }
     
    763763    fprintf(stderr,"not an array !!!!!!!\n");
    764764  }
    765   return handle;
     765  return *handle;
    766766}
    767767
     
    804804    url=JSValToChar(cx,argv);
    805805  }
     806  hInternet.waitingRequests[hInternet.nb]=strdup(url);
    806807  if(argc==4){
    807808    char *body;
     
    812813#endif
    813814    if(JS_IsArrayObject(cx,header))
    814       res1=setHeader(hInternet,cx,header);
     815      setHeader(&hInternet,cx,header);
    815816#ifdef ULINET_DEBUG
    816817    fprintf(stderr,"BODY (%s)\n",body);
    817818#endif
    818     res=InternetOpenUrl(res1,url,body,strlen(body),
    819                         INTERNET_FLAG_NO_CACHE_WRITE,0);   
     819    InternetOpenUrl(&hInternet,hInternet.waitingRequests[hInternet.nb],body,strlen(body),
     820                    INTERNET_FLAG_NO_CACHE_WRITE,0);   
     821    processDownloads(&hInternet);
    820822    free(body);
    821823  }else{
    822824    if(argc==3){
    823825      char *body=JSValToChar(cx,&argv[2]);
    824       res=InternetOpenUrl(hInternet,url,body,strlen(body),
    825                           INTERNET_FLAG_NO_CACHE_WRITE,0);
     826      InternetOpenUrl(&hInternet,hInternet.waitingRequests[hInternet.nb],body,strlen(body),
     827                      INTERNET_FLAG_NO_CACHE_WRITE,0);
     828      processDownloads(&hInternet);
    826829      free(body);
    827     }
    828     res=InternetOpenUrl(hInternet,url,NULL,0,
    829                         INTERNET_FLAG_NO_CACHE_WRITE,0);
    830   }
    831   tmpValue=(char*)malloc((res.nDataLen+1)*sizeof(char));
    832   InternetReadFile(res,(LPVOID)tmpValue,res.nDataLen,&dwRead);
     830    }else{
     831      InternetOpenUrl(&hInternet,hInternet.waitingRequests[hInternet.nb],NULL,0,
     832                      INTERNET_FLAG_NO_CACHE_WRITE,0);
     833      processDownloads(&hInternet);
     834    }
     835  }
     836  tmpValue=(char*)malloc((hInternet.ihandle[0].nDataLen+1)*sizeof(char));
     837  InternetReadFile(hInternet.ihandle[0],(LPVOID)tmpValue,hInternet.ihandle[0].nDataLen,&dwRead);
    833838#ifdef ULINET_DEBUG
    834839  fprintf(stderr,"content downloaded (%d) (%s) \n",dwRead,tmpValue);
     
    846851  if(argc>=2)
    847852    free(method);
    848   if(argc==4 && res.header!=NULL){
    849     curl_slist_free_all(res.header);
    850   }
    851   InternetCloseHandle(hInternet);
     853  InternetCloseHandle(&hInternet);
    852854  JS_MaybeGC(cx);
    853855  return JS_TRUE;
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