]> granicus.if.org Git - curl/commitdiff
Alexey Simak filed bug report #1600447
authorDaniel Stenberg <daniel@haxx.se>
Tue, 5 Dec 2006 13:49:29 +0000 (13:49 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 5 Dec 2006 13:49:29 +0000 (13:49 +0000)
(http://curl.haxx.se/bug/view.cgi?id=1600447) in which he noted that active
FTP connections don't work with the multi interface. The problem is here that
the multi interface state machine has a state during which it can wait for the
data connection to connect, but the active connection is not done in the same
step in the sequence as the passive one is so it doesn't quite work for
active. The active FTP code still use a blocking function to allow the remote
server to connect.

The fix (work-around is a better word) for this problem is to set the
boolean prematurely that the data connection is completed, so that the "wait
for connect" phase ends at once.

CHANGES
RELEASE-NOTES
lib/ftp.c

diff --git a/CHANGES b/CHANGES
index 0da422072f1ec7865bcbcf655b4217aaee1ce6b4..399fca226b06b2054f614c87cd5c94bccf01daf0 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -7,6 +7,22 @@
                                   Changelog
 
 Daniel (5 December 2006)
+- Alexey Simak filed bug report #1600447
+  (http://curl.haxx.se/bug/view.cgi?id=1600447) in which he noted that active
+  FTP connections don't work with the multi interface. The problem is here
+  that the multi interface state machine has a state during which it can wait
+  for the data connection to connect, but the active connection is not done in
+  the same step in the sequence as the passive one is so it doesn't quite work
+  for active. The active FTP code still use a blocking function to allow the
+  remote server to connect.
+
+  The fix (work-around is a better word) for this problem is to set the
+  boolean prematurely that the data connection is completed, so that the "wait
+  for connect" phase ends at once.
+
+  The proper fix, left for the future, is of course to make the active FTP
+  case to act in a non-blocking way too.
+
 - Matt Witherspoon fixed a problem case when the CPU load went to 100% when a
   HTTP upload was disconnected:
 
index 28cf5837fe8453ab96224cb4c9ee801cafecf627..2db25e372430588065a76d2165762362aafc6887 100644 (file)
@@ -26,7 +26,8 @@ This release includes the following bugfixes:
  o HTTP responses on persistent connections without Content-Length nor chunked
    encoding are now considered to be without response body
  o Content-Range: header parsing improved
- o CPU 100% load when upload connection broke
+ o CPU 100% load when HTTP upload connection broke
+ o active FTP didn't work with multi interface
 
 Other curl-related news:
 
@@ -44,6 +45,6 @@ advice from friends like these:
 
  James Housley, Olaf Stueben, Yang Tse, Gisle Vanem, Bradford Bruce,
  Ciprian Badescu, Dmitriy Sergeyev, Nir Soffer, Venkat Akella, Toon Verwaest,
- Matt Witherspoon
+ Matt Witherspoon, Alexey Simak
 
         Thanks! (and sorry if I forgot to mention someone)
index e3d14a2ba212cb6b9e9f6623a32928d51cff2ad8..4e4dd5346b81c52c7d779166f29100f55978ed7d 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -573,7 +573,7 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
 
             /* output debug output if that is requested */
             if(data->set.verbose)
-              Curl_debug(data, CURLINFO_HEADER_IN, 
+              Curl_debug(data, CURLINFO_HEADER_IN,
                          line_start, (size_t)perline, conn);
 
             /*
@@ -1168,6 +1168,15 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
 
 #endif /* end of ipv4-specific code */
 
+  /* this tcpconnect assignment below is a hackish work-around to make the
+     multi interface with active FTP work - as it will not wait for a
+     (passive) connect in Curl_is_connected().
+
+     The *proper* fix is to make sure that the active connection from the
+     server is done in a non-blocking way. Currently, it is still BLOCKING.
+  */
+  conn->bits.tcpconnect = TRUE;
+
   state(conn, FTP_PORT);
   return result;
 }
@@ -3433,7 +3442,7 @@ CURLcode Curl_nbftpsendf(struct connectdata *conn,
     return res;
 
   if(conn->data->set.verbose)
-    Curl_debug(conn->data, CURLINFO_HEADER_OUT, 
+    Curl_debug(conn->data, CURLINFO_HEADER_OUT,
                sptr, (size_t)bytes_written, conn);
 
   if(bytes_written != (ssize_t)write_len) {
@@ -3491,7 +3500,7 @@ CURLcode Curl_ftpsendf(struct connectdata *conn,
       break;
 
     if(conn->data->set.verbose)
-      Curl_debug(conn->data, CURLINFO_HEADER_OUT, 
+      Curl_debug(conn->data, CURLINFO_HEADER_OUT,
                  sptr, (size_t)bytes_written, conn);
 
     if(bytes_written != (ssize_t)write_len) {