curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Managing multiple cookie sets with multi-handle

From: Daniel Stenberg via curl-library <>
Date: Fri, 7 Feb 2020 09:03:59 +0100 (CET)

On Thu, 6 Feb 2020, Austin Mease via curl-library wrote:

> I would like to maintain 2 sets of cookies (2 users, Primary and Secondary)
> under one multi-handle. From what I can tell, there are 2 approaches to take
> for this:

> 1) Maintain 2 share handles with CURL_LOCK_DATA_COOKIE set, set the
> appropriate curlSH for a given curl request. 2) Rely on the default
> curlM cookie cache, and maintain one curlSH more as an override.

> My questions are:1) From a performance perspective, does it matter? 2) From
> intended use, which is preferable?3) If there is only one cookie set, does
> it hamper performance to continue to set the cookies through curlSH?

To me it sounds like you've understood the choices perfectly.

I can't think of anything that will make either approach perform particularly
better or worse, as the selection of which particular "jar" to use is
basically just changing a pointer once. So, for performance it doesn't matter.

When it just comes to what is the smartest way for your application, it is
difficult for me to come with detailed certain advice since I don't have
enough insights into your requirements and use case. I think I personally
would prefer two different share objects for the two different cookie storage
areas, so that it would get more explicit exactly which transfer is using
which cookies.

  / | Commercial curl support up to 24x7 is available!
                   | Private help, bug fixes, support, ports, new features

Received on 2020-02-07