cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: API for getting header

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 17 Sep 2003 09:48:38 +0200 (CEST)

On Wed, 17 Sep 2003 jerry_at_oridus.com wrote:

> I only know we can use curl_slist_append( ) to customize my own header for
> requests but another way around, does libcurl have any API to let us get
> header fields from response returned by http server?

Yes it has. CURLOPT_HEADERFUNCTION is the option you want.

This is described in the tutorial.

> I would like to get "Set-Cookie:" field in response from server side

You'll get all headers, extract those you want.

> Or, we need to get the response first, pull out header as a curl_slist, then
> parse it ourself?

You don't "pull headers" and they don't come "as a curl_slist".

> or, we can get cookie from somewhere? Does libcurl provide API to fetch it?
> how do we easily achive this goal?

I want to introduce a cookie API in a future release. We have a draft on how
to make it work: http://curl.haxx.se/dev/COOKIES

-- 
 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-17