1CURLOPT_SOCKS5_AUTH(3) libcurl CURLOPT_SOCKS5_AUTH(3)
2
3
4
6 CURLOPT_SOCKS5_AUTH - methods for SOCKS5 proxy authentication
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SOCKS5_AUTH, long bitmask);
12
14 Pass a long as parameter, which is set to a bitmask, to tell libcurl
15 which authentication method(s) are allowed for SOCKS5 proxy authentica‐
16 tion. The only supported flags are CURLAUTH_BASIC, which allows user‐
17 name/password authentication, CURLAUTH_GSSAPI, which allows GSS-API au‐
18 thentication, and CURLAUTH_NONE, which allows no authentication. Set
19 the actual user name and password with the CURLOPT_PROXYUSERPWD(3) op‐
20 tion.
21
23 CURLAUTH_BASIC|CURLAUTH_GSSAPI
24
26 All
27
29 CURL *curl = curl_easy_init();
30 if(curl) {
31 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
32
33 /* request to use a SOCKS5 proxy */
34 curl_easy_setopt(curl, CURLOPT_PROXY, "socks5://user:pass@myproxy.com");
35
36 /* enable username/password authentication only */
37 curl_easy_setopt(curl, CURLOPT_SOCKS5_AUTH, (long)CURLAUTH_BASIC);
38
39 /* Perform the request */
40 curl_easy_perform(curl);
41 }
42
44 Added in 7.55.0
45
47 Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if
48 not, or CURLE_NOT_BUILT_IN if the bitmask contains unsupported flags.
49
51 CURLOPT_PROXY(3), CURLOPT_PROXYTYPE(3)
52
53
54
55ibcurl 8.2.1 April 26, 2023 CURLOPT_SOCKS5_AUTH(3)