CURLOPT_FTP_USE_PRET(3)
π CURLOPT_FTP_USE_PRET π
okay bestie, so this is a page from the Library Functions Manual and honestly? it's a niche little gem but it slaps once you get it. let's get into it π«Ά
β¨ NAME β¨
CURLOPT_FTP_USE_PRET β the "use PRET for FTP" option, literally what it says on the tin π
πΈ SYNOPSIS πΈ
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_USE_PRET, long enable);
so you're passing a long in there, bestie. keep that in mind π
π¦ DESCRIPTION π¦
okay so, you pass a long. that's it, that's the whole vibe at first glance.
if the value is 1, it tells curl to send a PRET command before PASV (and EPSV). yeah, PRET is that extra little pre-command. certain FTP servers β mainly drftpd, hi drftpd ily π β require this non-standard command for directory listings as well as up and downloads in PASV mode. so if you're hitting one of those servers and it's being weird about things, this is your girl.
heads up though: this has no effect when you're using the active FTP transfers mode. like, none at all. it's a passive-mode-only situation, no cap π
π DEFAULT π
0
like, off by default. as it should be, honestly. icon behavior β
π PROTOCOLS π
this functionality affects ftp only. that's it. just ftp. periodt π
π₯ EXAMPLE π₯
here's the whole thing in action, bestie β every line, nothing skipped:
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL,
"ftp://example.com/old-server/file.txt");
/* a drftpd server, do it */
curl_easy_setopt(curl, CURLOPT_FTP_USE_PRET, 1L);
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
}
see how it just drops that 1L in there before performing? yeah. that's the whole move. slay β¨
π AVAILABILITY π
added in curl 7.20.0, so she's been around a minute π§
π 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)for the whole lore
π SEE ALSO π
like, her sister options. go read 'em, iykyk π¦
vibe check recap:PRETbeforePASV/EPSV, default0, ftp only, no effect in active mode, added in7.20.0. that's the tea β
and that's the page, bestie π mwah. brought to you by the Library Functions Manual, from libcurl, dated 2026-10-12 β go forth and set your options responsibly ππ
π¦ 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