curl-library
Re: libcurl does not update cookie
Date: Sun, 24 May 2015 15:57:04 -0400
On 5/24/2015 2:07 PM, Daniel Stenberg wrote:
> On Sun, 24 May 2015, Alexander Dyagilev wrote:
>
>> Cookie: test_cookie_2=value2; test_cookie_2=base_value2
>
> Ah, I suspect this happens because...
>
>> curl_easy_setopt (m_curl, CURLOPT_COOKIELIST, "Set-Cookie:
>> test_cookie_2=base_value2");
>
> Doesn't specify domain or path so libcurl sets a default set derived
> from the URL, which probably aren't identical to what the cookie you
> receive from the site gets so they get stored as two separate cookies
> by libcurl, but using the same name. A rather peculiar behavior, but
> defined in the spec. But I can't immediately spot why they would end
> up different.
>
> I supect that either enabling VERBOSE or perhaps getting the cookies
> stored with CURLOPT_COOKIEJAR will make the differences between the
> two cookies notable.
>
> It could of course also be a bug in libcurl that makes this happen. I
> can't rule that out.
>
Alexander the way to tie it to a domain is to set the domain in the
Set-Cookie, otherwise it's listed as "unknown". However if you do that
the cookie applies to all subdomains. That is just the way Set-Cookie is
specified. If you want it exact then import via the Netscape format.
I've added an example to CURLOPT_COOKIELIST [1] showing how you can do that.
[1]: http://curl.haxx.se/libcurl/c/CURLOPT_COOKIELIST.html
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-05-24