cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Clarification on CURLOPT_WRITEFUNCTION behaviour

From: Chris Kruger <chrisk_at_dugeo.com>
Date: Fri, 01 Oct 2010 14:39:11 +0800

On 01/10/10 13:56, Jeff Pohlmeyer wrote:

> The write function gets called as many times as needed to complete
> the download. Are you checking the number of bytes you receive on
> each call? Are you returning that value from the callback?

Ok. I'm not checking the number of bytes I receive since I don't really
know how many to expect. I always return that I've processed all the
bytes. Since I'm connecting via HTTP to my own HTTP server application
I'm always closing the HTTP connection on the server side after I've
sent everything I need to. Typically it ranges from about 400 - 800
bytes so up until recently it seemed my data was handled all in one call
to the write function. It seems proxies have complicated that a bit.

So do I understand correctly that the only way I can determine that I've
received all my data is after curl_easy_perform returns? In the process
it calls the write function 1 to x times as needed? If so - that's all I
needed to clarify.

>> buggy behaviour was being exhibited in my application
> That really doesn't tell us much.

I *know* the bug is caused by what I don't understand about the write
function callback so my problem query really only relates to filling in
the gaps in my knowledge not to my bug. I only mention it as background
information; not for the sake of hoping somebody will help me fix it :)

Thank you.

-- 
Chris K.
chrisk_at_dugeo.com
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-10-01