1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_FTP_USE_PRET
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_FTP_USE_EPRT (3)
9  - CURLOPT_FTP_USE_EPSV (3)
10---
11
12# NAME
13
14CURLOPT_FTP_USE_PRET - use PRET for FTP
15
16# SYNOPSIS
17
18~~~c
19#include <curl/curl.h>
20
21CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_USE_PRET, long enable);
22~~~
23
24# DESCRIPTION
25
26Pass a long. If the value is 1, it tells curl to send a PRET command before
27PASV (and EPSV). Certain FTP servers, mainly drftpd, require this non-standard
28command for directory listings as well as up and downloads in PASV mode. Has
29no effect when using the active FTP transfers mode.
30
31# DEFAULT
32
330
34
35# PROTOCOLS
36
37FTP
38
39# EXAMPLE
40
41~~~c
42int main(void)
43{
44  CURL *curl = curl_easy_init();
45  if(curl) {
46    CURLcode res;
47    curl_easy_setopt(curl, CURLOPT_URL,
48                     "ftp://example.com/old-server/file.txt");
49
50    /* a drftpd server, do it! */
51    curl_easy_setopt(curl, CURLOPT_FTP_USE_PRET, 1L);
52
53    res = curl_easy_perform(curl);
54
55    curl_easy_cleanup(curl);
56  }
57}
58~~~
59
60# AVAILABILITY
61
62Added in 7.20.0
63
64# RETURN VALUE
65
66Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
67