curl-library
[Binary/ASCII FTP transfert] Is a bug or not ?
Date: Wed, 23 Mar 2005 16:24:42 +0100
Hi everybody !
I don't talk here of the ASCII transfer (CR / CRLF problem) not made
properly by libcurl, I know. But problem of FTP download transfer not
ending correctly!
Note: Libcurl version used is 7-13-0 (and I also try the 7-12-3 version)
I use libcurl to do FTP download transfers of an ASCII file (size on
server is 1Mo about).
My FTP server is a Linux 2.2.14-5.0 machine and my client application is
built (with a static libcurl) on the same machine.
In addition to the URL, password, login...options, I set these
followings options:
curl_easy_setopt(curl, CURLOPT_FTP_USE_EPSV,FALSE);
curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, FALSE);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, myCallbackFunction);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, <struct FtpFile>);
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, FALSE);
curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, my_progress_func);
curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &test);
The myCallbackFunction() function only write in a remote file (code from
curl examples) :
fwrite(dataOut->str, size, dataOut->total_size, vl_ftpfile->stream);
The my_progress_func() print the progression of bytes writing in the
remote file (code from curl examples):
int my_progress_func(double *test,double t, double d, double
ultotal, double ulnow) {
printf("Progression = %.2lf / %.2lf (%g %%)\n", d, t, d*100.0/t);
return 0;
}
I try a binary and an ASCII (CURLOPT_TRANSFERTTEXT) transfer of my file.
And I have the same problem, my client application run indefinitely
while the file is completely written.
Sample output:
....
TYPE I
< 200 Type set to I.
> SIZE my_file.txt
< 213 1050633
> RETR my_file.txt
< 150 Opening BINARY mode data connection my_file.txt (1050633 bytes).
* Getting file with size: 1050633
Progression = 4096.00 / 1050633.00 (0.38986 %)
Progression = 69632.00 / 1050633.00 (6.62762 %)
Progression = 913408.00 / 1050633.00 (86.9388 %)
Progression = 1050633.00 / 1050633.00 (100 %)
Progression = 1050633.00 / 1050633.00 (100 %)
Progression = 1050633.00 / 1050633.00 (100 %)
Progression = 1050633.00 / 1050633.00 (100 %)
Progression = 1050633.00 / 1050633.00 (100 %)
Progression = 1050633.00 / 1050633.00 (100 %)
Progression = 1050633.00 / 1050633.00 (100 %)
Progression = 1050633.00 / 1050633.00 (100 %)
...
(Same problem with 'TYPE A' transfer) the program continues again and
again and again....And when I set a timeout, I have a CURL error code
23....normal...
I don't understand. Libcurl seem to waiting for something, but what? All
bytes are written on the remote file (and the progression function
proves it). And when I check my remote file, this one is complete,
exactly the same size as on the server!!!!
This is me which makes a bad use of the libcurl, or is it a bug ? did I
forgot something ?
I think that someone may have the same problem as me (lot of usage of
libcurl is for FTP transfer I suppose).
Any help will be much appreciated.
Thks u.
Delphine.
Received on 2005-03-23