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