1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_FTP_SKIP_PASV_IP
5Section: 3
6Source: libcurl
7Protocol:
8  - FTP
9See-also:
10  - CURLOPT_FTPPORT (3)
11  - CURLOPT_FTP_USE_EPRT (3)
12Added-in: 7.15.0
13---
14
15# NAME
16
17CURLOPT_FTP_SKIP_PASV_IP - ignore the IP address in the PASV response
18
19# SYNOPSIS
20
21~~~c
22#include <curl/curl.h>
23
24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_SKIP_PASV_IP, long skip);
25~~~
26
27# DESCRIPTION
28
29Pass a long. If *skip* is set to 1, it instructs libcurl to not use the IP
30address the server suggests in its 227-response to libcurl's PASV command when
31libcurl connects the data connection. Instead libcurl reuses the same IP
32address it already uses for the control connection. It still uses the port
33number from the 227-response.
34
35This option allows libcurl to work around broken server installations or funny
36network setups that due to NATs, firewalls or incompetence report the wrong IP
37address. Setting this option also reduces the risk for various sorts of client
38abuse by malicious servers.
39
40This option has no effect if PORT, EPRT or EPSV is used instead of PASV.
41
42# DEFAULT
43
441 since 7.74.0, was 0 before then.
45
46# %PROTOCOLS%
47
48# EXAMPLE
49
50~~~c
51int 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
71Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
72