curl-library
Re: CURLOPT_WRITEFUNCTION returning missing DATA
Date: Wed, 13 Mar 2002 10:35:41 +0100 (MET)
On Tue, 12 Mar 2002, Nash Kabbara wrote:
> When I run , CURLOPT_WRITEFUNCTION, option not all data is being passed to
> "char file[]". I am supposed to get an XML string ,but I only get part of
> it. Now when I DO NOT set the CURLOPT_WRITEFUNCTION option curl outputs the
> complete XML string to stdout. I need to find out why calling
> CURLOPT_WRITEFUNCTION is eating part of my returned data. Thanks in advance
> for any help. All the relevant info i below.
Your code wrongly assumes that the data you get is zero terminated. It isn't.
You must be careful to *NOT* depend on zero bytes in the data stream implying
anything in particular. There might be lots of zero bytes in the data.
If you check out the library code, you'll quickly see that it uses the
callback internally as well, so there's no difference in the library code
when calling external callbacks to write the data to when it calls the
internal callback. The only differnce here is that the internal one uses only
the passed in data length, where your code treats it as zero-terminted.
Or am I wrong?
-- Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/Received on 2002-03-13