Changeset 834 for trunk/zoo-project/zoo-kernel
- Timestamp:
- Jun 20, 2017, 9:38:47 AM (8 years ago)
- Location:
- trunk/zoo-project/zoo-kernel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/ulinet.c
r828 r834 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){ … … 89 89 ; 90 90 #endif 91 tmp=strtok(buffer,";"); 92 int cnt=0; 91 93 _HINTERNET *psInternet=(_HINTERNET *)data; 92 tmp=strtok(buffer,";");93 if(tmp!=NULL){94 sprintf( CCookie[psInternet->id],"%s",tmp);94 if(tmp!=NULL && psInternet!=NULL){ 95 psInternet->cookie=(char*)malloc(sizeof(char)*(strlen(tmp)+1)); 96 sprintf(psInternet->cookie,"%s",tmp); 95 97 } 96 98 } … … 334 336 if(handle.url!=NULL) 335 337 free(handle.url); 336 free(handle.mimeType); 337 handle.mimeType = NULL; 338 if(handle.mimeType!=NULL) 339 free(handle.mimeType); 340 if(handle.cookie!=NULL) 341 free(handle.cookie); 338 342 } 339 343 if(handle0->handle) … … 365 369 hInternet->ihandle[hInternet->nb].url = NULL; 366 370 hInternet->ihandle[hInternet->nb].mimeType = NULL; 371 hInternet->ihandle[hInternet->nb].cookie = NULL; 367 372 hInternet->ihandle[hInternet->nb].nDataLen = 0; 368 373 hInternet->ihandle[hInternet->nb].id = hInternet->nb; … … 370 375 hInternet->ihandle[hInternet->nb].pabyData = NULL; 371 376 hInternet->ihandle[hInternet->nb].post = NULL; 372 377 373 378 curl_easy_setopt(hInternet->ihandle[hInternet->nb].handle, CURLOPT_COOKIEFILE, "ALL"); 374 379 #ifndef TIGER … … 474 479 475 480 /** 476 * Initialize the CCookie for a specific index (hInternet.nb)477 * 478 * @param hInternet the HINTERNET structure to know the CCookie index to reset481 * Initialize the cookie for a specific index (hInternet.nb) 482 * 483 * @param hInternet the HINTERNET structure to know the cookie index to reset 479 484 * @return 1 480 485 * @see HINTERNET 481 486 */ 482 487 int freeCookieList(HINTERNET hInternet){ 483 memset(&CCookie[hInternet.nb][0],0,1024); 488 if(hInternet.ihandle[hInternet.nb].cookie) 489 free(hInternet.ihandle[hInternet.nb].cookie); 490 hInternet.ihandle[hInternet.nb].cookie=NULL; 484 491 #ifndef TIGER 485 492 curl_easy_setopt(hInternet.ihandle[hInternet.nb].handle, CURLOPT_COOKIELIST, "ALL"); … … 530 537 } 531 538 532 CCookie[hInternet.id][0]=0;533 534 539 if( *lpdwNumberOfBytesRead < dwDataSize ) 535 540 return 0; -
trunk/zoo-project/zoo-kernel/ulinet.h
r817 r834 54 54 #define MAX_REQ 50 55 55 56 #ifdef _ULINET57 static char CCookie[MAX_REQ][1024];58 #else59 /**60 * The cookies found61 */62 extern char CCookie[MAX_REQ][1024];63 #endif64 65 56 #ifdef __cplusplus 66 57 extern "C" { … … 88 79 char *mimeType; //!< the mimeType returned by the server 89 80 char *post; //!< the potential POST XML content 81 char* cookie; //!< The potential Cookie returned by the server 90 82 int hasCacheFile; //!< 1 if we used a cache file 91 83 int nDataLen; //!< the length of the downloaded content
Note: See TracChangeset
for help on using the changeset viewer.