From c834213ad52c52431e9ca597862dc81839cabe84 Mon Sep 17 00:00:00 2001 From: Gokhan Sengun Date: Mon, 19 Dec 2011 14:35:20 +0100 Subject: FTP: perform active connections non-blocking 1- Two new error codes are introduced. CURLE_FTP_ACCEPT_FAILED to be set whenever ACCEPTing fails because of FTP server connected. CURLE_FTP_ACCEPT_TIMEOUT to be set whenever ACCEPTing timeouts. Neither of these errors are considered fatal and control connection remains OK because it could just be a firewall blocking server to connect to the client. 2- One new setopt option was introduced. CURLOPT_ACCEPTTIMEOUT_MS It sets the maximum amount of time FTP client is going to wait for a server to connect. Internal default accept timeout is 60 seconds. --- tests/data/DISABLED | 4 +--- tests/data/test1206 | 9 ++------- tests/data/test1207 | 9 ++------- tests/data/test1208 | 9 ++------- tests/data/test591 | 2 +- tests/data/test592 | 2 +- tests/data/test593 | 2 +- tests/libtest/lib591.c | 3 ++- 8 files changed, 12 insertions(+), 28 deletions(-) (limited to 'tests') diff --git a/tests/data/DISABLED b/tests/data/DISABLED index 88336f1c0..5a0f2bf95 100644 --- a/tests/data/DISABLED +++ b/tests/data/DISABLED @@ -2,8 +2,6 @@ # test cases are run by runtests.pl. Just add the plain test case numbers, one # per line. # Lines starting with '#' letters are treated as comments. -591 -592 -593 594 +1209 1211 diff --git a/tests/data/test1206 b/tests/data/test1206 index ba578a1e2..3f853d1d9 100644 --- a/tests/data/test1206 +++ b/tests/data/test1206 @@ -36,12 +36,6 @@ FTP PORT and 425 on download s/^EPRT \|1\|(.*)/EPRT \|1\|/ - -# The protocol part does not include QUIT simply because the error is -# CURLE_OPERATION_TIMEDOUT (28) which is a generic timeout error without -# specificly saying for which connection it concerns, and for timeouts libcurl -# marks the control channel as "invalid". As this test case times out for the -# data connection it could still use the control channel. USER anonymous PASS ftp@example.com @@ -50,9 +44,10 @@ EPRT |1| TYPE I SIZE 1206 RETR 1206 +QUIT -28 +10 diff --git a/tests/data/test1207 b/tests/data/test1207 index 6ca713196..283e46d5b 100644 --- a/tests/data/test1207 +++ b/tests/data/test1207 @@ -36,12 +36,6 @@ FTP PORT and 421 on download s/^EPRT \|1\|(.*)/EPRT \|1\|/ - -# The protocol part does not include QUIT simply because the error is -# CURLE_OPERATION_TIMEDOUT (28) which is a generic timeout error without -# specificly saying for which connection it concerns, and for timeouts libcurl -# marks the control channel as "invalid". As this test case times out for the -# data connection it could still use the control channel. USER anonymous PASS ftp@example.com @@ -50,9 +44,10 @@ EPRT |1| TYPE I SIZE 1207 RETR 1207 +QUIT -28 +10 diff --git a/tests/data/test1208 b/tests/data/test1208 index 725d18afa..a0d428b43 100644 --- a/tests/data/test1208 +++ b/tests/data/test1208 @@ -36,12 +36,6 @@ FTP PORT download, no data conn and no transient negative reply s/^EPRT \|1\|(.*)/EPRT \|1\|/ - -# The protocol part does not include QUIT simply because the error is -# CURLE_OPERATION_TIMEDOUT (28) which is a generic timeout error without -# specificly saying for which connection it concerns, and for timeouts libcurl -# marks the control channel as "invalid". As this test case times out for the -# data connection it could still use the control channel. USER anonymous PASS ftp@example.com @@ -50,9 +44,10 @@ EPRT |1| TYPE I SIZE 1208 RETR 1208 +QUIT -28 +12 diff --git a/tests/data/test591 b/tests/data/test591 index 0d4bac7dd..e04ae5bcc 100644 --- a/tests/data/test591 +++ b/tests/data/test591 @@ -64,7 +64,7 @@ STOR 591 QUIT -28 +10 diff --git a/tests/data/test592 b/tests/data/test592 index 4af04e31c..487290dd4 100644 --- a/tests/data/test592 +++ b/tests/data/test592 @@ -64,7 +64,7 @@ STOR 592 QUIT -28 +10 diff --git a/tests/data/test593 b/tests/data/test593 index 811bf93c6..c3b1f91e5 100644 --- a/tests/data/test593 +++ b/tests/data/test593 @@ -64,7 +64,7 @@ STOR 593 QUIT -28 +12 diff --git a/tests/libtest/lib591.c b/tests/libtest/lib591.c index 101f2db26..8a55e2cd1 100644 --- a/tests/libtest/lib591.c +++ b/tests/libtest/lib591.c @@ -77,7 +77,8 @@ int test(char *URL) easy_setopt(easy, CURLOPT_FTPPORT, "-"); /* server connection timeout */ - easy_setopt(easy, CURLOPT_CONNECTTIMEOUT, strtol(libtest_arg2, NULL, 10)); + easy_setopt(easy, CURLOPT_ACCEPTTIMEOUT_MS, + strtol(libtest_arg2, NULL, 10)*1000); multi_init(multi); -- cgit v1.2.3