cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: cookies

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 7 Jan 2002 15:34:04 +0100 (MET)

On Mon, 7 Jan 2002, T. Bharath wrote:

> Yes your solution is abetter one As you had rightly pointed out, the same
> cookie seems to exist multiple times in the list

That indicates a problem somewhere, I'd say.

> I am trying to emulate a browser where by i download the first page and the
> parse it and retrieve all the other objects used to render that page There
> may be multiple threads doing the same(trying to retrieve the same or a
> different page) Now its quite possible that each time i retrieve an object
> from the page(all objects are retrieved simultaneoulsy in different
> threads) the cookie with the same name and obviously from the same domain
> are sent and dumped into the file causing this problem.

Ah, you mean that each thread writes the cookies to a single file that is
later read by curl? The intention is still that only each cookie should only
exist once in the list. A cookie being a unique combination of name, domain
and path.

> The only way i can avoid this is to stop dumping the cookies in the file If
> i dont specify the COOKIE_JAR option then i believe curl doesnt handle any
> cookies (that is it doesnt send back the cookies) am i right?

You can specify the CURLOPT_COOKIEFILE with a non-existing file to make curl
read and send back cookies. But then it won't store any cookies except in
memory.

> Is there a way to avoid this prob

I'd appreciate if you could check why/if curl accepts more than one cookie
using the same name/path/domain when read from a file.

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2002-01-07