Re: cookie and CURLOPT_COOKIEFILE
Date: Wed, 17 Sep 2003 00:13:27 -0700
> Subject: Re: cookie and CURLOPT_COOKIEFILE
> On Tue, 16 Sep 2003, Jerry G. Chiuan wrote:
> > In order to receive cookie from server and use it in subsequent
> > need to enable cookie parser w/ CURLOPT_COOKIEFILE what happens if the
> > filename we specify has existed?
> As documented, you give libcurl a file name to read existing cookies from.
> the file exists, libcurl will try to read cookies from it.
my purpose of using it is to actually get cookie from server ( from
"Set-Cookie" in response header ), and set it in subsequent requests.
I am not trying to read existing cookie from an existing file
According to tutorial ( see below in
http://curl.haxx.se/libcurl/c/the-guide.html ), we can approach it by set
CURLOPT_COOKIEFILE w/ a file which doesn't exist.
****Many times this is enough, and you may not have to save the cookies to
disk at all. Note that the file you specify to CURLOPT_COOKIEFILE doesn't
have to exist to enable the parser, so a common way to just enable the
and not read able might be to use a file name you know doesn't exist.*****
But, according to main page of curl_easy_setopt( ):
****Given an empty or non-existing file, this option will
enable cookies for this curl handle, making it under-
stand and parse received cookies and then use matching
cookies in future request.*****
I think users would prefer to simply do this way:
curl_easy_setopt(handle_name, CURLOPT_COOKIEFILE, "" ) -or-
, instead of trying to pass file which doesn't exist
> > cuz I don't want to ensure the filename does not exist before using it
> And you can't think of a single file name that is next to guaranteed to
nobody ca 100% guarantee the filename doesn't exist. Certainly it depends on
how libcurl searches its existence
Therefore, I think we can remove "pass file which doesn't exist" from
document for people who simply want to retrive cookie from server side, not
existing file in disk.
very appreciate any clarification
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
Received on 2003-09-17