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