cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: cookie interface suggestion

From: Cris Bailiff <c.bailiff+curl_at_devsecure.com>
Date: Thu, 19 Jun 2003 20:27:48 +1000

Hi Guys,

On Thu, 19 Jun 2003 07:54 pm, Daniel Stenberg wrote:
> On Thu, 19 Jun 2003, Lorenzo Pastrana wrote:
> > 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.

From my point of view, I'm quite happy for libcurl to 'manage' the cookie jar
(adding cookies to it on reception, picking the cookies to use for each
request, expiring them etc.). What I would like as a feature, though, is the
ability to LOAD and SAVE the jar from other than a flat file.

I would like to just be able to ask for the string version of the jar (the
file contents) either as a single, or by getting a (public) API to the
internal structure to iterate through and store the cookies.

> 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.

I could do the same kind of thing with the RECVFUNC/SENDFUNC, but it seems a
shame to duplicate all that cookie logic that libcurl handles. I don't need
to work out which cookies should be in the request - I just want to put the
jar away in a database between requests, not in a file.

Loading the jar isn't such a big - Ideally, I'd just hand the jar contents
back as a string (and have libcurl parse it as normal), but I could feed them
in one by one if necessary (but, like I said, I'd like libcurl to choose
which ones are needed, not me.)

Hope this makes sense!

Cheers,
Cris

-------------------------------------------------------
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.php
Received on 2003-06-19