cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Disabling automatic handling of 'Set-Cookie:'

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 5 Apr 2006 00:07:50 +0200 (CEST)

On Wed, 5 Apr 2006, Ashu Sharma wrote:

> I have a query about handling of cookies in libcurl. Is it possible to
> disable automatic handling of cookies by libcurl. By default, on receiving a
> HTTP header 'Set-Cookie:', libcurl adds the cookie for subsequent requests.

That is incorrect. By default libcurl ignores incoming cookies, you need to
enable it for it to be done. CURLOPT_COOKIEJAR and CURLOPT_COOKIEFILE enable
that.

> curl_easy_setopt(curlhandle, CURLOPT_HTTPHEADER, sList)
>
> where one of the headers in sList is the cookie I want to set (I've tried
> using CURLOPT_COOKIE too). This results in libcurl sending out two 'Cookie:'
> headers to the server

Yes, telling libcurl to deal with cookies and then provide your set is kind of
confusing. What libcurl version is this? I was under the impression libcurl
doesn't behave like that in recent versions.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2006-04-05