aboutsummaryrefslogtreecommitdiff
path: root/lib/ftp.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-09-04 05:16:06 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-09-04 05:16:06 +0000
commit7e845e7cfdd658caccc60f687d5d5d68d7e88937 (patch)
treef5937f8827f2f1f9ea2073dd640545045a17c459 /lib/ftp.c
parent56d9624b566ac15ffb4b4b6eef220a5000b767e0 (diff)
Added FTP_SKIP_PASV_IP and --ftp-skip-pasv-ip
Diffstat (limited to 'lib/ftp.c')
-rw-r--r--lib/ftp.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index bc30e2258..4d89723c7 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -1601,8 +1601,18 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
return CURLE_FTP_WEIRD_227_FORMAT;
}
- snprintf(newhost, sizeof(newhost),
- "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
+ /* we got OK from server */
+ if(data->set.ftp_skip_ip) {
+ /* told to ignore the remotely given IP but instead use the one we used
+ for the control connection */
+ infof(data, "Skips %d.%d.%d.%d for data connection, uses %s instead\n",
+ ip[0], ip[1], ip[2], ip[3],
+ conn->ip_addr_str);
+ snprintf(newhost, sizeof(newhost), "%s", conn->ip_addr_str);
+ }
+ else
+ snprintf(newhost, sizeof(newhost),
+ "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
newport = (port[0]<<8) + port[1];
}
else if(ftp->count1 == 0) {
@@ -1622,8 +1632,6 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
return CURLE_FTP_WEIRD_PASV_REPLY;
}
- /* we got OK from server */
-
if(data->change.proxy && *data->change.proxy) {
/*
* This is a tunnel through a http proxy and we need to connect to the