1CURLOPT_PROXYAUTH(3) curl_easy_setopt options CURLOPT_PROXYAUTH(3)
2
3
4
6 CURLOPT_PROXYAUTH - HTTP proxy authentication methods
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYAUTH, long bitmask);
12
14 Pass a long as parameter, which is set to a bitmask, to tell libcurl
15 which HTTP authentication method(s) you want it to use for your proxy
16 authentication. If more than one bit is set, libcurl will first query
17 the site to see what authentication methods it supports and then pick
18 the best one you allow it to use. For some methods, this will induce an
19 extra network round-trip. Set the actual name and password with the
20 CURLOPT_PROXYUSERPWD(3) option.
21
22 The bitmask can be constructed by or'ing together the bits fully listed
23 and described in the CURLOPT_HTTPAUTH(3) man page.
24
26 CURLAUTH_BASIC
27
29 HTTP
30
32 CURL *curl = curl_easy_init();
33 if(curl) {
34 CURLcode ret;
35 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
36 /* use this proxy */
37 curl_easy_setopt(curl, CURLOPT_PROXY, "http://local.example.com:1080");
38 /* allow whatever auth the proxy speaks */
39 curl_easy_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
40 /* set the proxy credentials */
41 curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, "james:007");
42 ret = curl_easy_perform(curl);
43 curl_easy_cleanup(curl);
44 }
45
47 Added in 7.10.7
48
50 Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if
51 not, or CURLE_NOT_BUILT_IN if the bitmask specified no supported au‐
52 thentication methods.
53
55 CURLOPT_PROXY(3), CURLOPT_PROXYTYPE(3), CURLOPT_PROXYUSERPWD(3), CUR‐
56 LOPT_PROXYPORT(3),
57
58
59
60libcurl 7.85.0 May 17, 2022 CURLOPT_PROXYAUTH(3)