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