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: sharing cookies … bug?

From: Daniel Stenberg via curl-library <>
Date: Thu, 5 Mar 2020 16:51:41 +0100 (CET)

On Thu, 5 Mar 2020, Felipe Gasper via curl-library wrote:

Hi Felipe!

I think I know what the problems is.

> SHARE_SETOPT( easy1, share );
> curl_easy_setopt(easy1, CURLOPT_COOKIEFILE, "");

Here you enable cookie-sharing and enables the cookie engine on the easy1

> SHARE_SETOPT( easy2, share );
> curl_easy_setopt( easy2, CURLOPT_URL, "" );

Here to just enable cookie-sharing but you never enable the cookie engine for
the second handle so while the cookies are known to the handle, it hasn't been
told to use them. This can probably be fixed by adding:

     curl_easy_setopt(easy2, CURLOPT_COOKIEFILE, "");

The reason this change is necessary, is because the previous behavior was
actually a bug that could lead to "accidental" use of cookies in the second
request. That isses was brought in #4429 back in September 2019, the fix
landed in 7.67.0:

  / | Commercial curl support up to 24x7 is available!
                   | Private help, bug fixes, support, ports, new features
Received on 2020-03-05