Changeset 607 for trunk/zoo-project/zoo-kernel/ulinet.c
- Timestamp:
- Mar 12, 2015, 3:14:52 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/ulinet.c
r579 r607 329 329 #endif 330 330 curl_easy_setopt(hInternet->ihandle[hInternet->nb].handle,CURLOPT_POSTFIELDS,lpszHeaders); 331 //curl_easy_setopt(hInternet->handle,CURLOPT_POSTFIELDSIZE,dwHeadersLength+1);332 if(hInternet->ihandle[hInternet->nb].header!=NULL)333 curl_easy_setopt(hInternet->ihandle[hInternet->nb].handle,CURLOPT_HTTPHEADER,hInternet->ihandle[hInternet->nb].header);334 }331 curl_easy_setopt(hInternet->ihandle[hInternet->nb].handle,CURLOPT_POSTFIELDSIZE,dwHeadersLength+1); 332 } 333 if(hInternet->ihandle[hInternet->nb].header!=NULL) 334 curl_easy_setopt(hInternet->ihandle[hInternet->nb].handle,CURLOPT_HTTPHEADER,hInternet->ihandle[hInternet->nb].header); 335 335 336 336 curl_easy_setopt(hInternet->ihandle[hInternet->nb].handle,CURLOPT_URL,lpszUrl); … … 366 366 if(tmp!=NULL) 367 367 hInternet->ihandle[i].mimeType=strdup(tmp); 368 curl_easy_getinfo(hInternet->ihandle[i].handle,CURLINFO_RESPONSE_CODE,&hInternet->ihandle[i].code); 368 369 curl_multi_remove_handle(hInternet->handle, hInternet->ihandle[i].handle); 369 370 curl_easy_cleanup(hInternet->ihandle[i].handle); … … 437 438 } 438 439 440 441 /** 442 * Use basic authentication for accessing a ressource 443 * 444 * @param hInternet the _HINTERNET structure 445 * @param login the login to use to authenticate 446 * @param passwd the password to use to authenticate 447 */ 448 int setBasicAuth(HINTERNET hInternet,char* login,char* passwd){ 449 char *tmp; 450 tmp=(char*)malloc((strlen(login)+strlen(passwd)+2)*sizeof(char)); 451 sprintf(tmp,"%s:%s",login,passwd); 452 if(curl_easy_setopt(hInternet.ihandle[hInternet.nb].handle,CURLOPT_USERPWD,tmp)==CURLE_OUT_OF_MEMORY){ 453 free(tmp); 454 return -1; 455 } 456 curl_easy_setopt(hInternet.ihandle[hInternet.nb].handle, CURLOPT_HTTPAUTH,CURLAUTH_ANY); 457 free(tmp); 458 return 0; 459 }
Note: See TracChangeset
for help on using the changeset viewer.