curl-library
Re: Disabling automatic handling of 'Set-Cookie:'
Date: Wed, 5 Apr 2006 16:26:33 +0530
On 4/5/06, Daniel Stenberg <daniel_at_haxx.se> wrote:
>
> 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.
Hi again,
Even if curl is handling cookies, would it be possible to disable this
temporarily at runtime. Just like COOKIEFILE or COOKIEJAR automatically
enable the cookie handling, is there some way to turn it off too, at
runtime?
Documentation for CURLOPT_HTTPHEADER mentions that: "If you add a header
that is otherwise generated and used by libcurl internally, your added one
will be used instead." However, this doesn't seem to be happening. In the
sList being provided for CURLOPT_HTTPHEADER, one of the headers is in the
format:
Cookie: ABCD=EFGH
Am I making a mistake here, because of which the Cookie header that libcurl
otherwise intends to send is not gettign overwritten and two Cookie headers
are being sent instead?
Thanks,
Ashutosh
Received on 2006-04-05