cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: response data received from server

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 11 Sep 2003 10:49:33 +0200 (CEST)

On Wed, 10 Sep 2003, Jerry G. Chiuan wrote:

> I would like to have my own callback function invoked by curl once the data
> is received from server side

I suggest you take this over to the libcurl mailing list, where you'll reach
more libcurl users.

CURLOPT_WRITEFUNCTION is there for you.

> Then I can manipulate the data via A.
>
> - is it doable? or I have to "copy" the data into my buffer? how long does
> the data would be "alive"? when the data would be deleted?

You have to copy the data. When you return from the callback, the buffer will
be re-used for other purposes.

> - Furthermore, who needs to delete the data? curl would do it?

curl deals with its buffers itself, you deal with your buffers! :-)

IMHO, the getinmemory.c example shows one way to do this pretty smoothly:

http://curl.haxx.se/lxr/source/docs/examples/getinmemory.c

-- 
 Daniel Stenberg -- curl: been grokking URLs since 1998
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-09-11