cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTP cookies set by client and server

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 20 Dec 2010 10:51:16 +0100 (CET)

On Mon, 20 Dec 2010, Arunkumar Manickam wrote:

> My application uses both CURLOPT_COOKIE and CURLOPT_COOKIEJAR file. If
> server sets a cookie named say, "SERVERCOOKIE" , curl manages this cookie
> automatically. If the application also adds a cookie of the same name
> "SERVERCOOKIE" , then CURL is sending two cookies one managed by CURL ( set
> by server ) and one set by the application instead of sending only one.

Correct. CURLOPT_COOKIE will *unconditionally* send the cookie the app
provides, no matter if there's a cookie named the same thing in the cookie
"storage".

> Is there an option in CURL to make one of them take precedence, preferably
> the one set by the application, and send just one cookie instead of two.

To me it sounds like you should be using CURLOPT_COOKIELIST instead, which
adds a cookie to the internal cookie storage which will make it get treated
just like any other cookie in upcoming requests.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-12-20