CURLOPT_FTP_USE_EPRT.3 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. .\" generated by cd2nroff 0.1 from CURLOPT_FTP_USE_EPRT.md
  2. .TH CURLOPT_FTP_USE_EPRT 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_FTP_USE_EPRT \- use EPRT for FTP
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_USE_EPRT, long enabled);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a long. If the value is 1, it tells curl to use the EPRT command when
  12. doing active FTP downloads (which is enabled by
  13. \fICURLOPT_FTPPORT(3)\fP). Using EPRT means that libcurl first attempts to use
  14. EPRT before using PORT, but if you pass zero to this option, it avoids using
  15. EPRT, only plain PORT.
  16. The EPRT command is a slightly newer addition to the FTP protocol than PORT
  17. and is the preferred command to use since it enables IPv6 to be used. Old FTP
  18. servers might not support it, which is why libcurl has a fallback mechanism.
  19. Sometimes that fallback is not enough and then this option might come handy.
  20. If the server is an IPv6 host, this option has no effect as EPRT is necessary
  21. then.
  22. .SH DEFAULT
  23. .SH PROTOCOLS
  24. This functionality affects ftp only
  25. .SH EXAMPLE
  26. .nf
  27. int main(void)
  28. {
  29. CURL *curl = curl_easy_init();
  30. if(curl) {
  31. CURLcode res;
  32. curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/file.txt");
  33. /* contact us back, aka "active" FTP */
  34. curl_easy_setopt(curl, CURLOPT_FTPPORT, "-");
  35. /* FTP the way the neanderthals did it */
  36. curl_easy_setopt(curl, CURLOPT_FTP_USE_EPRT, 0L);
  37. res = curl_easy_perform(curl);
  38. curl_easy_cleanup(curl);
  39. }
  40. }
  41. .fi
  42. .SH AVAILABILITY
  43. Added in curl 7.10.5
  44. .SH RETURN VALUE
  45. Returns CURLE_OK
  46. .SH SEE ALSO
  47. .BR CURLOPT_FTPPORT (3),
  48. .BR CURLOPT_FTP_USE_EPSV (3)