CURLOPT_FTP_USE_EPRT(3)

πŸ’… CURLOPT_FTP_USE_EPRT β€” use EPRT for FTP

okay bestie, welcome to the libcurl manual page for CURLOPT_FTP_USE_EPRT, straight out of the Library Functions Manual, and no cap this one's a lil niche but it's lowkey iconic if you're doing active FTP. let's get into it πŸŽ€


✨ SYNOPSIS ✨

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_USE_EPRT, long enabled);

πŸ¦‹ DESCRIPTION πŸ¦‹

so you pass a long here. if that value is 1, you're telling curl "yes bestie, use the EPRT command when doing active FTP downloads" β€” and active FTP downloads are the ones enabled by CURLOPT_FTPPORT(3), iykyk.

using EPRT means libcurl first attempts to use EPRT before using PORT. but if you pass zero to this option, it avoids using EPRT entirely and only uses plain PORT. periodt.

the EPRT command is a slightly newer addition to the FTP protocol than PORT, and it's the preferred command to use since it enables IPv6 to be used 🌈. old FTP servers might not support it, which is exactly why libcurl has a fallback mechanism. sometimes that fallback is just not enough, and that's when this option might come in handy 🫢.

heads up: if the server is an IPv6 host, this option has no effect β€” because EPRT is necessary then. like, non-negotiable necessary πŸ’€

πŸŽ€ DEFAULT πŸŽ€

(the original page doesn't list a default value here β€” it's giving mystery, and honestly? same πŸ’…)


🌸 PROTOCOLS 🌸

this functionality affects ftp only. ftp girlies rise πŸ‘‘


⭐ EXAMPLE ⭐

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/file.txt");

    /* contact us back, aka "active" FTP */
    curl_easy_setopt(curl, CURLOPT_FTPPORT, "-");

    /* FTP the way the neanderthals did it */
    curl_easy_setopt(curl, CURLOPT_FTP_USE_EPRT, 0L);

    result = curl_easy_perform(curl);

    curl_easy_cleanup(curl);
  }
}

πŸ’œ AVAILABILITY πŸ’œ

added in curl 7.10.5 β€” vintage, but make it fashion πŸŽ€


πŸ”₯ RETURN VALUE πŸ”₯

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

CURLE_OK (0) means everything was OK πŸ₯³, non-zero means an error occurred 😭 β€” see libcurl-errors(3) if you need the full tea.


πŸ‘‘ SEE ALSO πŸ‘‘


that's the whole page, bestie β€” go forth and EPRT responsibly ✨

this lil masterpiece came from libcurl, dated 2026-10-12, and it lives at CURLOPT_FTP_USE_EPRT(3) in the Library Functions Manual. mwah πŸ’‹ 🫢

πŸ“¦ where this page comes from