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