curl-library
Re: cookie interface suggestion
Date: Thu, 19 Jun 2003 11:54:33 +0200 (CEST)
On Thu, 19 Jun 2003, Lorenzo Pastrana wrote:
> And there is an explicit verb for saving to a specific file at some time :)
> .. witch I had to hack a while ago to work with persistant connections.
Yeah, I remember that and I've been wanting to address that in a nice generic
way. This could be it!
> If I undestand correctly : a cookie-jar will be mapped in memory (list of
> curl_cookie structs) for edition.
You could use LOAD to load cookies from a given file. The cookies are then
kept by libcurl and they are associated with a given easy handle.
To write down the internal database of cookies to a "cookie jar", you'd use
SAVE.
> The API seems ok to me (very cUrl-ish ;)
Hehe, that's on purpose. I want the API to feel "curlish", as it makes it
easier to understand if you've already understood other concepts in curl. I
also consider the previous choices somewhat successful, so I'm staying with
it.
> Although it might be worth some basic 'default' automation, I mean : derive
> a cookie-jar filename from the request to save all cookies related to the
> document..
You could do that in two ways:
1. By simply intercepting the cookies using the RECVFUNC callback (previously
called just FUNC but changed now to differ better from the SENDFUNC), keep
track of them yourself and do whatever you want!
2. Let libcurl receive everything and then afterwards you get all cookies that
are associated with a given host using the GET option.
This does not offer you to write cookies from a specific host to a specific
file automaticly by libcurl, but I fail to see why we need this specific
feature. Can you come up with a reasonable explanation why we would?
> I read the FUNC spec and I'm not sure if this is what you ment by 'proceed
> as normal'.
I just meant that the callback has the option to stop libcurl from putting the
cookie into its own internal database. If the RECVFUNC returns 0, libcurl will
parse the cookie and deal with it just like it does today.
-- Daniel Stenberg -- curl: been grokking URLs since 1998 ------------------------------------------------------- This SF.Net email is sponsored by: INetU Attention Web Developers & Consultants: Become An INetU Hosting Partner. Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.phpReceived on 2003-06-19