Changeset 863 for branches/prototype-v0/zoo-project/zoo-kernel/ulinet.c
- Timestamp:
- Feb 5, 2018, 1:19:13 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/prototype-v0/zoo-project/zoo-kernel/ulinet.c
r862 r863 70 70 71 71 /** 72 * Write the downloaded content to a_HINTERNET structure72 * Write the downloaded content in the file pouted by the _HINTERNET structure 73 73 * 74 74 * @param buffer the buffer to read … … 89 89 psInternet=(_HINTERNET *)data; 90 90 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 96 94 buffer=NULL; 97 95 return realsize; … … 443 441 * @param dwFlags desired download mode (INTERNET_FLAG_NO_CACHE_WRITE for not using cache file) 444 442 * @param dwContext not used 443 * @param conf the main configuration file maps pointer 445 444 * @return the updated HINTERNET 446 445 */ 447 HINTERNET InternetOpenUrl(HINTERNET* hInternet,LPCTSTR lpszUrl,LPCTSTR lpszHeaders,size_t dwHeadersLength,size_t dwFlags,size_t dwContext ){446 HINTERNET InternetOpenUrl(HINTERNET* hInternet,LPCTSTR lpszUrl,LPCTSTR lpszHeaders,size_t dwHeadersLength,size_t dwFlags,size_t dwContext,const maps* conf){ 448 447 449 448 char filename[255]; 449 int ldwFlags=INTERNET_FLAG_NEED_FILE; 450 450 struct MemoryStruct header; 451 map* memUse=getMapFromMaps(conf,"main","memory"); 451 452 452 453 hInternet->ihandle[hInternet->nb].handle=curl_easy_init( ); … … 480 481 curl_easy_setopt(hInternet->ihandle[hInternet->nb].handle, CURLOPT_VERBOSE, 1); 481 482 #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) 484 488 { 485 489 case INTERNET_FLAG_NO_CACHE_WRITE: … … 491 495 memset(filename,0,255); 492 496 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); 494 507 free(tmpUuid); 495 508 hInternet->ihandle[hInternet->nb].filename=strdup(filename);
Note: See TracChangeset
for help on using the changeset viewer.