CURLOPT_FTP_USE_PRET.md (1319B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_FTP_USE_PRET 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_FTP_USE_EPRT (3) 9 - CURLOPT_FTP_USE_EPSV (3) 10 Protocol: 11 - FTP 12 Added-in: 7.20.0 13 --- 14 15 # NAME 16 17 CURLOPT_FTP_USE_PRET - use PRET for FTP 18 19 # SYNOPSIS 20 21 ~~~c 22 #include <curl/curl.h> 23 24 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_USE_PRET, long enable); 25 ~~~ 26 27 # DESCRIPTION 28 29 Pass a long. If the value is 1, it tells curl to send a PRET command before 30 PASV (and EPSV). Certain FTP servers, mainly drftpd, require this non-standard 31 command for directory listings as well as up and downloads in PASV mode. Has 32 no effect when using the active FTP transfers mode. 33 34 # DEFAULT 35 36 0 37 38 # %PROTOCOLS% 39 40 # EXAMPLE 41 42 ~~~c 43 int 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 65 curl_easy_setopt(3) returns a CURLcode indicating success or error. 66 67 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 68 libcurl-errors(3).