1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_FTP_USE_EPRT
5Section: 3
6Source: libcurl
7Protocol:
8  - FTP
9See-also:
10  - CURLOPT_FTPPORT (3)
11  - CURLOPT_FTP_USE_EPSV (3)
12---
13
14# NAME
15
16CURLOPT_FTP_USE_EPRT - use EPRT for FTP
17
18# SYNOPSIS
19
20~~~c
21#include <curl/curl.h>
22
23CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_USE_EPRT, long enabled);
24~~~
25
26# DESCRIPTION
27
28Pass a long. If the value is 1, it tells curl to use the EPRT command when
29doing active FTP downloads (which is enabled by
30CURLOPT_FTPPORT(3)). Using EPRT means that libcurl first attempts to use
31EPRT before using PORT, but if you pass zero to this option, it avoids using
32EPRT, only plain PORT.
33
34The EPRT command is a slightly newer addition to the FTP protocol than PORT
35and is the preferred command to use since it enables IPv6 to be used. Old FTP
36servers might not support it, which is why libcurl has a fallback mechanism.
37Sometimes that fallback is not enough and then this option might come handy.
38
39If the server is an IPv6 host, this option has no effect as EPRT is necessary
40then.
41
42# DEFAULT
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