1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_FTP_USE_EPSV 5Section: 3 6Source: libcurl 7Protocol: 8 - FTP 9See-also: 10 - CURLOPT_FTPPORT (3) 11 - CURLOPT_FTP_USE_EPRT (3) 12--- 13 14# NAME 15 16CURLOPT_FTP_USE_EPSV - use EPSV for FTP 17 18# SYNOPSIS 19 20~~~c 21#include <curl/curl.h> 22 23CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_USE_EPSV, long epsv); 24~~~ 25 26# DESCRIPTION 27 28Pass *epsv* as a long. If the value is 1, it tells curl to use the EPSV 29command when doing passive FTP downloads (which it does by default). Using 30EPSV means that libcurl first attempts to use the EPSV command before using 31PASV. If you pass zero to this option, it does not use EPSV, only plain PASV. 32 33The EPSV command is a slightly newer addition to the FTP protocol than PASV 34and is the preferred command to use since it enables IPv6 to be used. Old FTP 35servers might not support it, which is why libcurl has a fallback mechanism. 36Sometimes that fallback is not enough and then this option might come handy. 37 38If the server is an IPv6 host, this option has no effect. 39 40# DEFAULT 41 421 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, 53 "ftp://example.com/old-server/file.txt"); 54 55 /* let's shut off this modern feature */ 56 curl_easy_setopt(curl, CURLOPT_FTP_USE_EPSV, 0L); 57 58 res = curl_easy_perform(curl); 59 60 curl_easy_cleanup(curl); 61 } 62} 63~~~ 64 65# AVAILABILITY 66 67Along with FTP 68 69# RETURN VALUE 70 71Returns CURLE_OK if FTP is supported, and CURLE_UNKNOWN_OPTION if not. 72