taf2 / curb

Ruby bindings for libcurl
Other
1.29k stars 229 forks source link

Cannot edit cookies. #449

Open dElogics opened 8 months ago

dElogics commented 8 months ago

After enabling enable_cookies, trying to edit an existing (automatically set) cookie does not work. cookie= has no affect; it does not alter the stored cookie.

Tried with curb 1.0.5 on Ruby 3.1

taf2 commented 2 months ago

I think this PR will address this issue: https://github.com/taf2/curb/pull/455

uvlad7 commented 2 months ago

@dElogics you should understand the difference between custom cookies ('CURLOPT_COOKIE') and cookies in the internal engine (CURLOPT_COOKIELIST). The first ones are what cookies= sets and cookies returns. The last ones are where cookies from Set-Cookie go, what cookielist returns and what #455 is gonna let manipulate.

See this.

Also note that cookies = nil has no effect in curb, use cookies = ''; nil also doesn't work well with cookiefile and cookiejar, maybe it should be fixed.

dElogics commented 1 month ago

@dElogics you should understand the difference between custom cookies ('CURLOPT_COOKIE') and cookies in the internal engine (CURLOPT_COOKIELIST). The first ones are what cookies= sets and cookies returns. The last ones are where cookies from Set-Cookie go, what cookielist returns and what #455 is gonna let manipulate.

See this.

Also note that cookies = nil has no effect in curb, use cookies = ''; nil also doesn't work well with cookiefile and cookiejar, maybe it should be fixed.

Thanks for clarifying. I tried it out. Maybe the documentation must be updated?