aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2006-01-24 14:40:43 +0000
committerDaniel Stenberg <daniel@haxx.se>2006-01-24 14:40:43 +0000
commit67bf4f28ffcd7102602a83343da8df8058f9af4f (patch)
treecb528243df2039d951c85f9744b08413c58d581a /lib
parent803582f8ac264e5932d364208cbf475c84a4964f (diff)
Michal Marek provided a patch for FTP that makes libcurl continue to try PASV
even after EPSV returned a positive response code, if libcurl failed to connect to the port number the EPSV response said. Obviously some people are going through protocol-sensitive firewalls (or similar) that don't understand EPSV and then they don't allow the second connection unless PASV was used. This also called for a minor fix of test case 238.
Diffstat (limited to 'lib')
-rw-r--r--lib/ftp.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 3cdcc32ef..ecb717696 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -1661,6 +1661,18 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
Curl_resolv_unlock(data, addr); /* we're done using this address */
+ if (result && ftp->count1 == 0 && ftpcode == 229) {
+ infof(data, "got positive EPSV response, but can't connect. "
+ "Disabling EPSV\n");
+ /* disable it for next transfer */
+ conn->bits.ftp_use_epsv = FALSE;
+ data->state.errorbuf = FALSE; /* allow error message to get rewritten */
+ NBFTPSENDF(conn, "PASV", NULL);
+ ftp->count1++;
+ /* remain in the FTP_PASV state */
+ return result;
+ }
+
if(result)
return result;