CURLOPT_PROXYUSERPWD.md (1743B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_PROXYUSERPWD 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_PROXY (3) 9 - CURLOPT_PROXYPASSWORD (3) 10 - CURLOPT_PROXYTYPE (3) 11 - CURLOPT_PROXYUSERNAME (3) 12 Protocol: 13 - All 14 Added-in: 7.1 15 --- 16 17 # NAME 18 19 CURLOPT_PROXYUSERPWD - username and password 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_PROXYUSERPWD, char *userpwd); 27 ~~~ 28 29 # DESCRIPTION 30 31 Pass a char pointer as parameter, which should be [username]:[password] to use 32 for the connection to the HTTP proxy. Both the name and the password are URL 33 decoded before used, so to include for example a colon in the username you 34 should encode it as %3A. (This is different to how CURLOPT_USERPWD(3) is 35 used - beware.) 36 37 Use CURLOPT_PROXYAUTH(3) to specify the authentication method. 38 39 The application does not have to keep the string around after setting this 40 option. 41 42 Using this option multiple times makes the last set string override the 43 previous ones. Set it to NULL to disable its use again. 44 45 # DEFAULT 46 47 NULL 48 49 # %PROTOCOLS% 50 51 # EXAMPLE 52 53 ~~~c 54 int main(void) 55 { 56 CURL *curl = curl_easy_init(); 57 if(curl) { 58 CURLcode res; 59 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin"); 60 curl_easy_setopt(curl, CURLOPT_PROXY, "http://localhost:8080"); 61 curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, "clark%20kent:superman"); 62 res = curl_easy_perform(curl); 63 curl_easy_cleanup(curl); 64 } 65 } 66 ~~~ 67 68 # %AVAILABILITY% 69 70 # RETURN VALUE 71 72 curl_easy_setopt(3) returns a CURLcode indicating success or error. 73 74 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 75 libcurl-errors(3).