cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: cookies

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Fri, 8 Jul 2005 13:05:07 +0200 (CEST)

On Fri, 8 Jul 2005, Arvind Sachdeva wrote:

>> It would depend on what you did with the shared object in between these two
>> requests. If you re-use the same shared object (with cookies) the second
>> time, then the cookie would of course still be kept around in it.
>
> I am afraid i am observing that the cookie which I had set using
> curl_easy_setopt is not sent again automatically for the second handle.

Right, because there are only two ways using the current API that you can add
a cookie to the "jar". Using CURLOPT_COOKIE only adds the given string to the
outgoing request, it doesn't contain enough information to allow libcurl to
keep the cookie and have it associated with a domain, path and expiry time
etc.

Those two ways are 1) read cookies from a file and 2) read cookies from
incoming response headers.

That's one of the main reasons we need a new cookie API - if you really need
to access and modify single cookies the current API just doesn't cover it.

> But If reuse the same handle then cookie is sent in every subsequent
> request. Thats what I meant by cookie handle association. I believe, by
> design cookie should be associated to url not handle.

That's because the option is sticky, not because the cookie is associated with
that particular URL or anything.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2005-07-08