cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: File type to download

From: jvp <jvp_at_compu-weigh.com.au>
Date: Tue, 23 Jun 2009 10:32:31 +1000

Hi all
This is the latest test with same results.
If you guys just ignore that I am using FreeBasic, and just treat the
lines below as c code
(except for the syntax) then this example should be repeatable on any
machine that has
Watt library. The previous example used the multi interface, and I used
a Timer to abort
after 300 sec's.(which worked )

    curl_easy_setopt( ftp_handle, CURLOPT_VERBOSE,1)
    curl_easy_setopt( ftp_handle, CURLOPT_URL,
"ftp://xxx.xxx.xx.xxx/mc211.exe" )
    curl_easy_setopt( ftp_handle, CURLOPT_WRITEFUNCTION, @write_callback )
     curl_easy_setopt(ftp_handle, CURLOPT_USERPWD, "blah:blah")
'user:password
    curl_easy_perform(ftp_handle)
    curl_easy_cleanup(ftp_handle) 'cleanup and quit cURL

private function write_callback cdecl ( byval buffer as byte ptr,byval
size as integer,byval nitems as integer,byval outstream as any Ptr) as
Integer
    Dim as integer bytes = size * nitems 'multiply to get Nbr of Bytes
    put #FP ,,*buffer,bytes 'write bytes to file
    function = bytes 'this is used by
curl to verify delivered = written
end Function

The write_call back does the following:
Calculate Bytes and then writes these to a file that is already open.
Returns the Bytes written.

Now, what is worrying, is that nobody else can verify the Watt / Djgpp
library.
Even though Watt & cURL both compiled without any errors.
I am convinced there are no errors in my write_callback or the way I am
using curl_easy.
Considering that the above test works fine with a small html doc, but
fails on larger files
after 50+kb is the problem that is beyond the easy interface.

I am prepared to email the libraries so they can be verified with C
code, but really dont think
that is the problem.

Regards
Jan van de Poll
Received on 2009-06-23