CURLOPT_FTP_SKIP_PASV_IP.md (1761B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_FTP_SKIP_PASV_IP 5 Section: 3 6 Source: libcurl 7 Protocol: 8 - FTP 9 See-also: 10 - CURLOPT_FTPPORT (3) 11 - CURLOPT_FTP_USE_EPRT (3) 12 Added-in: 7.15.0 13 --- 14 15 # NAME 16 17 CURLOPT_FTP_SKIP_PASV_IP - ignore the IP address in the PASV response 18 19 # SYNOPSIS 20 21 ~~~c 22 #include <curl/curl.h> 23 24 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_SKIP_PASV_IP, long skip); 25 ~~~ 26 27 # DESCRIPTION 28 29 Pass a long. If *skip* is set to 1, it instructs libcurl to not use the IP 30 address the server suggests in its 227-response to libcurl's PASV command when 31 libcurl connects the data connection. Instead libcurl reuses the same IP 32 address it already uses for the control connection. It still uses the port 33 number from the 227-response. 34 35 This option allows libcurl to work around broken server installations or funny 36 network setups that due to NATs, firewalls or incompetence report the wrong IP 37 address. Setting this option also reduces the risk for various sorts of client 38 abuse by malicious servers. 39 40 This option has no effect if PORT, EPRT or EPSV is used instead of PASV. 41 42 # DEFAULT 43 44 1 since 7.74.0, was 0 before then. 45 46 # %PROTOCOLS% 47 48 # EXAMPLE 49 50 ~~~c 51 int main(void) 52 { 53 CURL *curl = curl_easy_init(); 54 if(curl) { 55 CURLcode res; 56 curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/file.txt"); 57 58 /* please ignore the IP in the PASV response */ 59 curl_easy_setopt(curl, CURLOPT_FTP_SKIP_PASV_IP, 1L); 60 res = curl_easy_perform(curl); 61 62 curl_easy_cleanup(curl); 63 } 64 } 65 ~~~ 66 67 # %AVAILABILITY% 68 69 # RETURN VALUE 70 71 curl_easy_setopt(3) returns a CURLcode indicating success or error. 72 73 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 74 libcurl-errors(3).