1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_FTPSSLAUTH
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_FTP_SSL_CCC (3)
9  - CURLOPT_USE_SSL (3)
10---
11
12# NAME
13
14CURLOPT_FTPSSLAUTH - order in which to attempt TLS vs SSL
15
16# SYNOPSIS
17
18~~~c
19#include <curl/curl.h>
20
21CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTPSSLAUTH, long order);
22~~~
23
24# DESCRIPTION
25
26Pass a long using one of the values from below, to alter how libcurl issues
27"AUTH TLS" or "AUTH SSL" when FTP over SSL is activated. This is only
28interesting if CURLOPT_USE_SSL(3) is also set.
29
30Possible *order* values:
31
32## CURLFTPAUTH_DEFAULT
33
34Allow libcurl to decide.
35
36## CURLFTPAUTH_SSL
37
38Try "AUTH SSL" first, and only if that fails try "AUTH TLS".
39
40## CURLFTPAUTH_TLS
41
42Try "AUTH TLS" first, and only if that fails try "AUTH SSL".
43
44# DEFAULT
45
46CURLFTPAUTH_DEFAULT
47
48# PROTOCOLS
49
50FTP
51
52# EXAMPLE
53
54~~~c
55int main(void)
56{
57  CURL *curl = curl_easy_init();
58  if(curl) {
59    CURLcode res;
60    curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/file.txt");
61    curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_TRY);
62    /* funny server, ask for SSL before TLS */
63    curl_easy_setopt(curl, CURLOPT_FTPSSLAUTH, (long)CURLFTPAUTH_SSL);
64    res = curl_easy_perform(curl);
65    curl_easy_cleanup(curl);
66  }
67}
68~~~
69
70# AVAILABILITY
71
72Added in 7.12.2
73
74# RETURN VALUE
75
76Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
77