Skip to content
cookie.c 29.1 KiB
Newer Older
  struct curl_slist *beg;
  struct Cookie *c;
  char *line;
Daniel Stenberg's avatar
Daniel Stenberg committed
  if((data->cookies == NULL) ||
      (data->cookies->numcookies == 0))
    return NULL;
  c = data->cookies->cookies;
  beg = list;
Daniel Stenberg's avatar
Daniel Stenberg committed
  while(c) {
    /* fill the list with _all_ the cookies we know */
    line = get_netscape_format(c);
Daniel Stenberg's avatar
Daniel Stenberg committed
    if(line == NULL) {
      curl_slist_free_all(beg);
      return NULL;
    }
    list = curl_slist_append(list, line);
    free(line);
Daniel Stenberg's avatar
Daniel Stenberg committed
    if(list == NULL) {
      curl_slist_free_all(beg);
      return NULL;
    }
Daniel Stenberg's avatar
Daniel Stenberg committed
    else if(beg == NULL) {
      beg = list;
    }
    c = c->next;
  }
  return list;
#endif /* CURL_DISABLE_HTTP || CURL_DISABLE_COOKIES */