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