curl-library
Re: libcurl does not update cookie
Date: Mon, 25 May 2015 16:27:48 +0300
Hello,
On 5/24/2015 10:57 PM, Ray Satiro via curl-library wrote:
> On 5/24/2015 2:07 PM, Daniel Stenberg wrote:
>>
>>> curl_easy_setopt (m_curl, CURLOPT_COOKIELIST, "Set-Cookie:
>>> test_cookie_2=base_value2");
>>
>> I supect that either enabling VERBOSE or perhaps getting the cookies
>> stored with CURLOPT_COOKIEJAR will make the differences between the
>> two cookies notable.
In the cookie database it sets domain as "unknown".
>
> 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.
OK, thank you for the response. It works this way.
But what if I would like to set a cookie for the all domains?
For example, a site can redirect me to a different one (not a subdomain)
and I want the cookie to be send to this redirected site also.
I think it would be possible if such an "unknown" cookie being sent only
in case there is no existing cookie with the same name for the domain of
URL.
For example:
In case our cookie db is:
unknown FALSE / FALSE 0 test_cookie_2 base_value2
Then request to http://mysite/test.php would include this header with
cookie:
Cookie: test_cookie_2=base_value2
But in case our cookie db is:
unknown FALSE / FALSE 0 test_cookie_2 base_value2
mysite FALSE / FALSE 0 test_cookie_2 value2
Then request to http://mysite/test.php would include this header with
cookie:
Cookie: test_cookie_2=value2
I.e. "unknown"-domain cookie is ignored because there is "mysite"-domain
cookie with the same name.
Is it possible to achieve in libcurl?
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-05-25