CURLOPT_PROXYUSERNAME.md (1576B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_PROXYUSERNAME 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_HTTPAUTH (3) 9 - CURLOPT_PROXYAUTH (3) 10 - CURLOPT_PROXYPASSWORD (3) 11 - CURLOPT_USERNAME (3) 12 Protocol: 13 - All 14 Added-in: 7.19.1 15 --- 16 17 # NAME 18 19 CURLOPT_PROXYUSERNAME - username to use for proxy authentication 20 21 # SYNOPSIS 22 23 ~~~c 24 #include <curl/curl.h> 25 26 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYUSERNAME, 27 char *username); 28 ~~~ 29 30 # DESCRIPTION 31 32 Pass a char pointer as parameter, which should be pointing to the 33 null-terminated username to use for the transfer. 34 35 CURLOPT_PROXYUSERNAME(3) sets the username to be used in protocol 36 authentication with the proxy. 37 38 To specify the proxy password use the CURLOPT_PROXYPASSWORD(3). 39 40 The application does not have to keep the string around after setting this 41 option. 42 43 # DEFAULT 44 45 blank 46 47 # %PROTOCOLS% 48 49 # EXAMPLE 50 51 ~~~c 52 int main(void) 53 { 54 CURL *curl = curl_easy_init(); 55 if(curl) { 56 CURLcode res; 57 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin"); 58 curl_easy_setopt(curl, CURLOPT_PROXY, "http://localhost:8080"); 59 curl_easy_setopt(curl, CURLOPT_PROXYUSERNAME, "mrsmith"); 60 curl_easy_setopt(curl, CURLOPT_PROXYPASSWORD, "qwerty"); 61 res = curl_easy_perform(curl); 62 curl_easy_cleanup(curl); 63 } 64 } 65 ~~~ 66 67 # %AVAILABILITY% 68 69 # RETURN VALUE 70 71 curl_easy_setopt(3) returns a CURLcode indicating success or error. 72 73 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 74 libcurl-errors(3).