cURL / Mailing Lists / curl-library / Single Mail


ftp downloading operation result

From: Spoon Man <>
Date: Tue, 26 Jul 2011 11:51:11 +0400


I'm investigating a bug in a file download module which uses libcurl. The bug is downloaded file sometimes gets corrupted.
The problem occurs after unsuccessful try to connect to SOCKS4 server. libcurl reports timeout, but after some time the request is coming and interpreted by event handlers as incoming data. As a result, 8 bytes of SOCKS4 header is written in the beginning of file. File size is kept, so 8-bytes tail is lost.
I'm a beginner in libcurl and don't yet understand whether this bug is in the libcurl or module I'm working on.

Here are some points of operation:

Curl_blockread_all() in socks.c returns CURLE_OPERATION_TIMEDOUT
Upper routines return CURLE_COULDNT_CONNECT through.

Something interesting happens in ftp_doing(). ftp_multi_statemach() has returned CURLE_COULDNT_CONNECT.
In that point I have a flag dophase_done set. So ftp_doing() also calls ftp_dophase_done() which sets the result to OK and
the error code is lost. The program continues working as nothing is happened.

Am I right that is was something wrong?

List admin:
Received on 2011-07-26