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
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms