cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Only receive a header file

From: Julien Chaffraix <julien.chaffraix_at_gmail.com>
Date: Thu, 4 Mar 2010 07:40:23 -0800

Hi,

> I'm working on a small program that needs to know the size of a file before
> it is downloaded via HTTP. The header file for these files does contain
> this information, so i was wondering if it is possible to only receive the
> header without the rest of the data.
> If so, how is that done?

Try setting the CURLOPT_HEADERFUNCTION on your easy handle. Once you
get the Content-Length header, just return -1 from your function to
abort the transfer.

Regards,
Julien
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-03-04