1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_SOCKS5_AUTH
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_PROXY (3)
9  - CURLOPT_PROXYTYPE (3)
10Protocol:
11  - All
12---
13
14# NAME
15
16CURLOPT_SOCKS5_AUTH - methods for SOCKS5 proxy authentication
17
18# SYNOPSIS
19
20~~~c
21#include <curl/curl.h>
22
23CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SOCKS5_AUTH, long bitmask);
24~~~
25
26# DESCRIPTION
27
28Pass a long as parameter, which is set to a bitmask, to tell libcurl which
29authentication method(s) are allowed for SOCKS5 proxy authentication. The only
30supported flags are *CURLAUTH_BASIC*, which allows username/password
31authentication, *CURLAUTH_GSSAPI*, which allows GSS-API authentication, and
32*CURLAUTH_NONE*, which allows no authentication. Set the actual username and
33password with the CURLOPT_PROXYUSERPWD(3) option.
34
35# DEFAULT
36
37CURLAUTH_BASIC|CURLAUTH_GSSAPI
38
39# EXAMPLE
40
41~~~c
42int main(void)
43{
44  CURL *curl = curl_easy_init();
45  if(curl) {
46    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
47
48    /* request to use a SOCKS5 proxy */
49    curl_easy_setopt(curl, CURLOPT_PROXY, "socks5://user:pass@myproxy.com");
50
51    /* enable username/password authentication only */
52    curl_easy_setopt(curl, CURLOPT_SOCKS5_AUTH, (long)CURLAUTH_BASIC);
53
54    /* Perform the request */
55    curl_easy_perform(curl);
56  }
57}
58~~~
59
60# AVAILABILITY
61
62Added in 7.55.0
63
64# RETURN VALUE
65
66Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
67CURLE_NOT_BUILT_IN if the bitmask contains unsupported flags.
68