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 <curl-library_at_cool.haxx.se>
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
handle.

> SHARE_SETOPT( easy2, share );
>
> curl_easy_setopt( easy2, CURLOPT_URL, "http://www.google.com/search?q=curl" );

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:

   https://github.com/curl/curl/issues/4429

-- 
  / daniel.haxx.se | Commercial curl support up to 24x7 is available!
                   | Private help, bug fixes, support, ports, new features
                   | https://www.wolfssl.com/contact/
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2020-03-05