curl-library
Re: How to retrieve "context" information in write/read callbacks?
Date: Wed, 6 Feb 2008 18:21:33 +0100 (CET)
On Wed, 6 Feb 2008, Andrea Funtò wrote:
> Unfortunately I cannot see this feature in libcurl: if I register a write
> callback with curl_easy_setopt(CURLOPT_WRITEFUNCTION), I can only provide a
> pointer to the memory area to be filled by libcurl before invoking my
> callback (through CURLOPT_WRITEDATA). There is no CURL handle available to
> the callback either... Am I missing some important point, or misintepreting
> the docs?
You're missing the point with CURLOPT_WRITEDATA. That is a pointer passed from
your app thru libcurl to the callback unmodified and untouched. You can make
it point to anything, and if you want lots of context and data sent to the
callback you most likely make it point to a fancy struct/class of yours and
then in your callback you extract all the info you need from that struct...
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.htmlReceived on 2008-02-06