CURLOPT_FTP_SSL_CCC(3)

CURLOPT_FTP_SSL_CCC</p> πŸ’…

okay bestie, settle in, because we're talking about the libcurl manual page for CURLOPT_FTP_SSL_CCC, straight out of the Library Functions Manual. she's niche, she's specific, and she's about to make your FTP-over-TLS life so much clearer (literally, you'll see). 🫢


✨ NAME ✨

CURLOPT_FTP_SSL_CCC β€” switch off SSL again with FTP after auth πŸŽ€

no like literally that's what she does. auth first, then the SSL goes bye-bye.


🌸 SYNOPSIS 🌸

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_SSL_CCC,
                          long how);

that's the whole vibe. one handle, one how, endless possibilities. πŸ’–


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so if you enable this option, libcurl goes ahead and uses CCC β€” that's Clear Command Channel, iykyk β€” and it shuts down the SSL/TLS layer after authenticating. the rest of the control channel communication remains unencrypted. yes, you read that right, unencrypted, bestie. this is a whole choice and I need you to know it. πŸ™ˆ

the reason you'd ever do this? it allows NAT routers to follow the FTP transaction. that's the whole point. that's the assignment. and honestly? kind of iconic of the NAT routers.

⚠️ important reminder: the SSL/TLS layer goes away after auth and the rest of the control channel is unencrypted. that's not a bug, that's the feature, but please know what you're signing up for πŸ’€

you pass a long using one of the values below:

  • CURLFTPSSL_CCC_NONE β€” do not attempt to use CCC. none. zero. nope. we're not doing that here. βœ‹
  • CURLFTPSSL_CCC_PASSIVE β€” do not initiate the shutdown, but wait for the server to do it. do not send a reply. she's passive, she's patient, she's letting the server take the lead. 🧚
  • CURLFTPSSL_CCC_ACTIVE β€” initiate the shutdown and wait for a reply. main character energy, she makes the first move and then waits for the response. πŸ‘‘

πŸ’œ DEFAULT πŸ’œ

CURLFTPSSL_CCC_NONE

yup. the safe one. the "we don't start nothing" one. slay. 🌈


πŸŽ€ PROTOCOLS πŸŽ€

this functionality affects ftp only. that's it. that's the protocol. don't come at her with anything else. ✨


πŸ”₯ EXAMPLE πŸ”₯

here's the whole thing, copy-paste ready, no notes:

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/file.txt");
    curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_CONTROL);
    /* go back to clear-text FTP after authenticating */
    curl_easy_setopt(curl, CURLOPT_FTP_SSL_CCC, CURLFTPSSL_CCC_ACTIVE);
    result = curl_easy_perform(curl);
    curl_easy_cleanup(curl);
  }
}

see that comment in there? /* go back to clear-text FTP after authenticating */ β€” that's the dream, that's the storyline, that's the plot. πŸ“


⭐ HISTORY ⭐

CURLFTPSSL_* enums became long types in 8.16.0. prior to this version a long cast was necessary when passed to curl_easy_setopt(3). so if you're on old curl and your compiler's being dramatic about types β€” that's why, bestie. πŸ’€


πŸ‘‘ AVAILABILITY πŸ‘‘

Added in curl 7.16.1. she's been here a minute. respect the elder. 🫢


🌸 RETURN VALUE 🌸

curl_easy_setopt(3) returns a CURLcode indicating success or error.

  • CURLE_OK (0) means everything was OK. we love a zero. πŸŽ‰
  • non-zero means an error occurred β€” see libcurl-errors(3) for the full breakdown of what went wrong.

πŸ’– SEE ALSO πŸ’–

go read them, they're all part of the same little FTP-over-SSL friend group. πŸ’…


okay that's the whole page!! mwah πŸ’‹ this was CURLOPT_FTP_SSL_CCC(3) from the libcurl manual, dated 2026-10-12 β€” and if you ever forget a detail just come right back here, I got you. no cap. πŸ¦‹βœ¨

πŸ“¦ where this page comes from