cURL / Mailing Lists / curl-library / Single Mail

curl-library

No error but libcurl returns CURLE_WRITE_ERROR

From: Juan Ignacio Hervás <jihervas_at_iies.es>
Date: Fri, 04 Apr 2003 18:48:17 +0200

I am trying to upload files to a remote FTP server but first, I check if a
file is in the server with the right size.
So, I am doing:
         sprintf (cmd, "CWD %s", remote_directory);
         headerlist = curl_slist_append (headerlist, cmd);
         sprintf (cmd, "SIZE %s", file_name);
         headerlist = curl_slist_append (headerlist, cmd);

         curl_easy_setopt (curl, CURLOPT_VERBOSE, TRUE);
         curl_easy_setopt (curl, CURLOPT_DEBUGFUNCTION, MyDebug);
         curl_easy_setopt (curl, CURLOPT_DEBUGDATA, pFileProgress);
         curl_easy_setopt(curl, CURLOPT_QUOTE, headerlist);
         res = curl_easy_perform (curl);

When I call this code between three or four times (depends on the number of
files in the remote directory), curl_easy_perform returns
CURLE_WRITE_ERROR. The curl code is calling Curl_client_write (sendf.c) and
this function is working with a 4096 bytes buffer:
In the first and second call it receives a buffer of 1993 bytes (these two
files are in the same remote directory) and in the third the buffer is 172
bytes long (but it has just 110 bytes left in its working buffer:
4096-1993-1993=110). Then it calls _flsbuf(c, stream) in fwrite.c and
returns 110.
As 110 != 172, Curl_client_write returns CURLE_WRITE_ERROR.

The next time I repeat the same routine it works (the internal working
buffer now is empty).

So, is it a normal behaviour? or I should not care about CURLE_WRITE_ERROR
in this routine?

Thanks in advance and sorry for the weird question in a Friday afternoon!

-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb:
Dedicated Hosting for just $79/mo with 500 GB of bandwidth!
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
Received on 2003-04-04