1--- 2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_FTP_USE_EPRT 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_FTPPORT (3) 9 - CURLOPT_FTP_USE_EPSV (3) 10--- 11 12# NAME 13 14CURLOPT_FTP_USE_EPRT - use EPRT for FTP 15 16# SYNOPSIS 17 18~~~c 19#include <curl/curl.h> 20 21CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_USE_EPRT, long enabled); 22~~~ 23 24# DESCRIPTION 25 26Pass a long. If the value is 1, it tells curl to use the EPRT command when 27doing active FTP downloads (which is enabled by 28CURLOPT_FTPPORT(3)). Using EPRT means that libcurl first attempts to use 29EPRT before using PORT, but if you pass zero to this option, it avoids using 30EPRT, only plain PORT. 31 32The EPRT command is a slightly newer addition to the FTP protocol than PORT 33and is the preferred command to use since it enables IPv6 to be used. Old FTP 34servers might not support it, which is why libcurl has a fallback mechanism. 35Sometimes that fallback is not enough and then this option might come handy. 36 37If the server is an IPv6 host, this option has no effect as EPRT is necessary 38then. 39 40# DEFAULT 41 42# PROTOCOLS 43 44# EXAMPLE 45 46~~~c 47int main(void) 48{ 49 CURL *curl = curl_easy_init(); 50 if(curl) { 51 CURLcode res; 52 curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/file.txt"); 53 54 /* contact us back, aka "active" FTP */ 55 curl_easy_setopt(curl, CURLOPT_FTPPORT, "-"); 56 57 /* FTP the way the neanderthals did it */ 58 curl_easy_setopt(curl, CURLOPT_FTP_USE_EPRT, 0L); 59 60 res = curl_easy_perform(curl); 61 62 curl_easy_cleanup(curl); 63 } 64} 65~~~ 66 67# AVAILABILITY 68 69Added in 7.10.5 70 71# RETURN VALUE 72 73Returns CURLE_OK 74