quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

CURLOPT_FTP_FILEMETHOD.md (2078B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_FTP_FILEMETHOD
      5 Section: 3
      6 Source: libcurl
      7 Protocol:
      8   - FTP
      9 See-also:
     10   - CURLOPT_DIRLISTONLY (3)
     11   - CURLOPT_FTP_SKIP_PASV_IP (3)
     12 Added-in: 7.15.1
     13 ---
     14 
     15 # NAME
     16 
     17 CURLOPT_FTP_FILEMETHOD - select directory traversing method for FTP
     18 
     19 # SYNOPSIS
     20 
     21 ~~~c
     22 #include <curl/curl.h>
     23 
     24 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_FILEMETHOD,
     25                           long method);
     26 ~~~
     27 
     28 # DESCRIPTION
     29 
     30 Pass a long telling libcurl which *method* to use to reach a file on a
     31 FTP(S) server.
     32 
     33 This option exists because some server implementations are not compliant to
     34 what the standards say should work.
     35 
     36 The argument should be one of the following alternatives:
     37 
     38 ## CURLFTPMETHOD_MULTICWD
     39 
     40 libcurl does a single CWD operation for each path part in the given URL. For
     41 deep hierarchies this means many commands. This is how RFC 1738 says it should
     42 be done. This is the default but the slowest behavior.
     43 
     44 ## CURLFTPMETHOD_NOCWD
     45 
     46 libcurl makes no CWD at all. libcurl does SIZE, RETR, STOR etc and gives a
     47 full path to the server for all these commands. This is the fastest behavior
     48 since it skips having to change directories.
     49 
     50 ## CURLFTPMETHOD_SINGLECWD
     51 
     52 libcurl does one CWD with the full target directory and then operates on the
     53 file &"normally" (like in the multicwd case). This is somewhat more standards
     54 compliant than 'nocwd' but without the full penalty of 'multicwd'.
     55 
     56 # DEFAULT
     57 
     58 CURLFTPMETHOD_MULTICWD
     59 
     60 # %PROTOCOLS%
     61 
     62 # EXAMPLE
     63 
     64 ~~~c
     65 int main(void)
     66 {
     67   CURL *curl = curl_easy_init();
     68   if(curl) {
     69     CURLcode res;
     70     curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/1/2/3/4/new.txt");
     71     curl_easy_setopt(curl, CURLOPT_FTP_FILEMETHOD,
     72                      (long)CURLFTPMETHOD_SINGLECWD);
     73 
     74     res = curl_easy_perform(curl);
     75 
     76     curl_easy_cleanup(curl);
     77   }
     78 }
     79 ~~~
     80 
     81 # %AVAILABILITY%
     82 
     83 # RETURN VALUE
     84 
     85 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     86 
     87 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     88 libcurl-errors(3).