CURLOPT_FTP_SSL_CCC.md (1723B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_FTP_SSL_CCC 5 Section: 3 6 Source: libcurl 7 Protocol: 8 - FTP 9 See-also: 10 - CURLOPT_FTPSSLAUTH (3) 11 - CURLOPT_PROTOCOLS_STR (3) 12 - CURLOPT_USE_SSL (3) 13 Added-in: 7.16.1 14 --- 15 16 # NAME 17 18 CURLOPT_FTP_SSL_CCC - switch off SSL again with FTP after auth 19 20 # SYNOPSIS 21 22 ~~~c 23 #include <curl/curl.h> 24 25 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_SSL_CCC, 26 long how); 27 ~~~ 28 29 # DESCRIPTION 30 31 If enabled, this option makes libcurl use CCC (Clear Command Channel). It 32 shuts down the SSL/TLS layer after authenticating. The rest of the control 33 channel communication remains unencrypted. This allows NAT routers to follow 34 the FTP transaction. Pass a long using one of the values below 35 36 ## CURLFTPSSL_CCC_NONE 37 38 do not attempt to use CCC. 39 40 ## CURLFTPSSL_CCC_PASSIVE 41 42 Do not initiate the shutdown, but wait for the server to do it. Do not send a 43 reply. 44 45 ## CURLFTPSSL_CCC_ACTIVE 46 47 Initiate the shutdown and wait for a reply. 48 49 # DEFAULT 50 51 CURLFTPSSL_CCC_NONE 52 53 # %PROTOCOLS% 54 55 # EXAMPLE 56 57 ~~~c 58 int main(void) 59 { 60 CURL *curl = curl_easy_init(); 61 if(curl) { 62 CURLcode res; 63 curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/file.txt"); 64 curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_CONTROL); 65 /* go back to clear-text FTP after authenticating */ 66 curl_easy_setopt(curl, CURLOPT_FTP_SSL_CCC, (long)CURLFTPSSL_CCC_ACTIVE); 67 res = curl_easy_perform(curl); 68 curl_easy_cleanup(curl); 69 } 70 } 71 ~~~ 72 73 # %AVAILABILITY% 74 75 # RETURN VALUE 76 77 curl_easy_setopt(3) returns a CURLcode indicating success or error. 78 79 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 80 libcurl-errors(3).