cURL / Mailing Lists / curl-library / Single Mail


Re: FIle size

From: jérôme Muffat-Méridol <>
Date: Thu, 29 Nov 2007 17:06:19 +0100

Hi Robert,

In case you have the same problem I faced, ie you need to allocate
memory before bytes start to come in but you also can't

I solved it this way: allocate at the point when the header is
received but before data arrives. This is pretty similar to what
Richard suggest, but not quite.

set CURLOPT_HEADERFUNCTION to a first function that will receive each
header line.
set CURLOPT_WRITEFUNCTION to a second function that saves the bytes in
the buffer.

At some point before actual data is received, the Header Function
receives a string starting with "Content-Length". The length to expect
follows the semi-colon.

Of course, if you're not interested in the contents at all and just
want to tell the user what size a download "would be", then I'd
investigate the first option Richard mentionned.

On 11/29/07, angel dario <> wrote:
> Hello...
> How can i auto-sign in into a http server like using curl?
> I am dealing with a website that requires to login before you I download
> anything.
> ________________________________
> Get the power of Windows + Web with the new Windows Live. Power up!
Received on 2007-11-29