cURL / Mailing Lists / curl-library / Single Mail


(no subject)

From: T. Bharath <>
Date: Mon, 7 Jan 2002 09:00:15 -0500

Yes your solution is abetter one
As you had rightly pointed out ,the same cookie seems to exist
multiple times in the list
Iam 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
from the same domain are sent and dumped into the file causing this problem.
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?
Is there a way to avoid this prob


Daniel Stenberg wrote:

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

> As a further note i believe the reason it gets in to the loop and then
> if(replace_old) { the second time is because we dont reset replace_old

> I think we need to reset that in
> if(replace_old) {
> co->next = clist->next; /* get the next-pointer first */
> ...
> + replace_old = FALSE;
> }
> Am I right

  (First, thanks again for your clever insights.)

  You shouldn't ever get into that block a second time, as that would
  that we have the same cookie in the list more than once.

  Anyway, I suggest that we instead of what you suggest (which probably
  be any good because the conditional check at the end of the function
  replace_old and it'll behave badly if it isn't "correct), just loop
  the list to get the 'lastc' pointer set correct. Like this:

  --- cookie.c 2001/10/30 12:08:17 1.26
  +++ cookie.c 2002/01/07 09:52:55
  @@ -377,8 +377,15 @@

           free(co); /* free the newly alloced memory */
           co = clist; /* point to the previous struct instead */
  - }

  + /* We have replaced a cookie, now skip the rest of the list but
  + make sure the 'lastc' pointer is properly set */
  + do {
  + lastc = clist;
  + clist = clist->next;
  + } while(clist);
  + break;
  + }
       lastc = clist;
       clist = clist->next;


      Daniel Stenberg -- curl groks URLs --
Received on 2002-01-07