On Sun, 14 Jul 2013, Clemens Gruber wrote:

I am using the newest version 7.31.0.

You are right, it’s a very old ftp server from OS-9, but because SIZE is not in the FTP RFC (959), the client should not depend on it. PASV is also not supported on this server.

... and yet PASV _is_ in RFC959! =)

I now have two capture files for you (zipped): http://178.189.19.236:8080/curl_ftp.zip

Thanks. It does indeed hint on something weird going on in libcurl. My current thinking is that the problem is like this:

1 - ftp_state_get_resp() gets called to handle the response to RETR (a 150)

2 - it deems the response to be fine, and since a PORT connection has been
    requested it allows the server to connect with a call to
    AllowServerConnect()

3 - the connection is "instant" and the code around line 2550 then doesn't
    properly change state

4 - when using verbose output, libcurl is slower and thus it probably isn't
    "instant" and thus the code flow changes somewhat and everything is dandy

I don't yet understand how this then triggers a second SIZE command, but it will at least end up in a funny state.

I'm thinking a decent fix could look like this and I'd be happy to hear your results or thoughts:

diff --git a/lib/ftp.c b/lib/ftp.c
index 5d78ad6..78cdb0c 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -2551,6 +2551,8 @@ static CURLcode ftp_state_get_resp(struct connectdata *conn,
         state(conn, FTP_STOP);
         ftpc->wait_data_conn = TRUE;
       }
+      else
+        return InitiateTransfer(conn);
     }
     else
       return InitiateTransfer(conn);

--

 / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to