Changeset 839 for branches/prototype-v0/zoo-project/zoo-kernel/ulinet.c
- Timestamp:
- Aug 7, 2017, 2:56:24 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/prototype-v0/zoo-project/zoo-kernel/ulinet.c
r821 r839 70 70 /** 71 71 * In case of presence of "Set-Cookie" in the headers red, store the cookie 72 * identifier in CCookie72 * identifier in cookie 73 73 * 74 74 * @param buffer the buffer to read … … 77 77 * @param data the _HINTERNET structure to write in 78 78 * @return the size red, -1 if buffer is NULL 79 * @see CCookie79 * @see cookie 80 80 */ 81 81 size_t header_write_data(void *buffer, size_t size, size_t nmemb, void *data){ 82 82 if(strncmp("Set-Cookie: ",(char*)buffer,12)==0){ 83 83 int i; 84 char env[256];85 char path[256];86 char domain[256];87 84 char* tmp; 88 85 for(i=0;i<12;i++) … … 92 89 ; 93 90 #endif 94 sscanf((char*)buffer,"%s; path=%s; domain=%s",env,path,domain); 91 tmp=strtok(buffer,";"); 92 int cnt=0; 95 93 _HINTERNET *psInternet=(_HINTERNET *)data; 96 tmp=strcat(env,CCookie[psInternet->id][0]); 97 #ifdef MSG_LAF_OUT 98 printf("\n**Cookie env : [%s] , path : [%s], domain : [%s]**\n",env,path,domain); 99 printf("buffer : %d (%s) (%s) (%s)\n",(buffer==NULL),buffer,tmp,CCookie); 100 #endif 101 strcpy(CCookie[psInternet->id][0],tmp); 94 if(tmp!=NULL && psInternet!=NULL){ 95 psInternet->cookie=(char*)malloc(sizeof(char)*(strlen(tmp)+1)); 96 sprintf(psInternet->cookie,"%s",tmp); 97 } 102 98 } 103 99 return size * nmemb;//write_data_into(buffer,size,nmemb,data,HEADER); … … 340 336 if(handle.url!=NULL) 341 337 free(handle.url); 342 free(handle.mimeType); 343 handle.mimeType = NULL; 338 if(handle.mimeType!=NULL) 339 free(handle.mimeType); 340 if(handle.cookie!=NULL) 341 free(handle.cookie); 344 342 } 345 343 if(handle0->handle) … … 371 369 hInternet->ihandle[hInternet->nb].url = NULL; 372 370 hInternet->ihandle[hInternet->nb].mimeType = NULL; 371 hInternet->ihandle[hInternet->nb].cookie = NULL; 373 372 hInternet->ihandle[hInternet->nb].nDataLen = 0; 374 373 hInternet->ihandle[hInternet->nb].id = hInternet->nb; … … 376 375 hInternet->ihandle[hInternet->nb].pabyData = NULL; 377 376 hInternet->ihandle[hInternet->nb].post = NULL; 378 377 379 378 curl_easy_setopt(hInternet->ihandle[hInternet->nb].handle, CURLOPT_COOKIEFILE, "ALL"); 380 379 #ifndef TIGER … … 475 474 curl_multi_remove_handle(hInternet->handle, hInternet->ihandle[i].handle); 476 475 curl_easy_cleanup(hInternet->ihandle[i].handle); 476 //fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,hInternet->ihandle[i].mimeType); 477 //fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,hInternet->ihandle[i].pabyData); 477 478 } 478 479 return 0; … … 480 481 481 482 /** 482 * Initialize the CCookie for a specific index (hInternet.nb)483 * 484 * @param hInternet the HINTERNET structure to know the CCookie index to reset483 * Initialize the cookie for a specific index (hInternet.nb) 484 * 485 * @param hInternet the HINTERNET structure to know the cookie index to reset 485 486 * @return 1 486 487 * @see HINTERNET 487 488 */ 488 489 int freeCookieList(HINTERNET hInternet){ 489 memset(&CCookie[hInternet.nb][0],0,1024);490 hInternet.ihandle[hInternet.nb].cookie=strdup(""); 490 491 #ifndef TIGER 491 492 curl_easy_setopt(hInternet.ihandle[hInternet.nb].handle, CURLOPT_COOKIELIST, "ALL"); … … 536 537 } 537 538 538 CCookie[hInternet.id][0]=0;539 540 539 if( *lpdwNumberOfBytesRead < dwDataSize ) 541 540 return 0;
Note: See TracChangeset
for help on using the changeset viewer.