cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTP Headers in Response message.

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Sat, 16 Mar 2013 21:52:35 +0100

On Sat, Mar 16, 2013 at 01:10:08AM -0400, Anil J wrote:
> In the libcurl tutorial, under section Customizing Operations, it is mentioned
> about how to manipulate the Headers in the Request message we can send using
> curl API. But I did not understood how we can handle the HTTP headers in the
> Response message coming from the server. 
>
> What if the application using curl API wants to check/read the HTTP headers in
> response message, and their values. The 'size_t write_data' function allows to
> read all the attachments of the message, but nothing is mentioned about the
> HTTP headers in the response message. 
>
> Can some one please elaborate a bit  on this?

The CURLOPT_HEADERFUNCTION callback can be used to get a copy of all the
headers as they are received. You can also use the curl_easy_getinfo() function
to retrieve parsed values from many of the common headers without having to
deal with raw headers yourself.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-03-16