cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Clear cookie file in Libcurl

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 29 Apr 2011 20:12:13 +0200 (CEST)

On Fri, 29 Apr 2011, east2006 east2006 wrote:

> I know

You know what? Your top-posting makes it very hard to follow what you're
talking about.

> but if I have a working handle it may cause an exception.

"it" being you deleting a file? No, that really cannot cause an exception. Can
you elaborate on what you're talking about?

> Maybe I'll just erase a specific cookie, I failed to do that too, I tried:
>
> curl_easy_setopt( curl, CURLOPT_COOKIELIST, "ALL" );

The docs says:

         Passing a magic string "ALL" will erase all cookies known by cURL

That's not "a specific cookie". It means libcurl will erase all cookies from
its memory.

> curl_easy_setopt(curl,CURLOPT_COOKIE, NULL);

What would that accomplish? The docs explains how that option is used to pass
on a cookie header to the server and setting a NULL will then not send such an
extra header.

> How can I successfully delete a cookie from a file?

libcurl doesn't delete cookies from files at all. It can save all cookies it
knows about to a file so you'd have to erase the specific cookie from memory
first, then have libcurl save all of them.

Or you write your own code that can parse a cookie file and delete the
appropriate line.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-04-29