Commit 606562aa authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

Michael Wallner provided a patch that allows "SESS" to be set with

CURLOPT_COOKIELIST, which then makes all session cookies get cleared. (slightly
edited by me, and the re-indent in cookie.c was also done by me)
parent f689d06c
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -6,6 +6,10 @@

                                  Changelog

Daniel (25 May 2006)
- Michael Wallner provided a patch that allows "SESS" to be set with
  CURLOPT_COOKIELIST, which then makes all session cookies get cleared.

Daniel (11 May 2006)
- David McCreedy provided a fix for CURLINFO_LASTSOCKET that does extended
  checks on the to-be-returned socket to make sure it truly seems to be alive
+2 −1
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ Curl and libcurl 7.15.4

This release includes the following changes:

 o CURLOPT_COOKIELIST set to "SESS" clears all session cookies
 o CURLINFO_LASTSOCKET returned sockets are now checked more before returned
 o curl-config got a --checkfor option to compare version numbers
 o line end conversions for FTP ASCII transfers
@@ -56,6 +57,6 @@ advice from friends like these:
 Dan Fandrich, Ilja van Sprundel, David McCreedy, Tor Arntsen, Xavier Bouchoux,
 David Byron, Michele Bini, Ates Goral, Katie Wang, Robson Braga Araujo,
 Ale Vesely, Paul Querna, Gisle Vanem, Mark Eichin, Roland Blom, Andreas
 Ntaflos, David Shaw
 Ntaflos, David Shaw, Michael Wallner

        Thanks! (and sorry if I forgot to mention someone)
+2 −0
Original line number Diff line number Diff line
@@ -762,6 +762,8 @@ Pass a char * to a cookie string. Cookie can be either in Netscape / Mozilla
format or just regular HTTP-style header (Set-Cookie: ...) format. If cURL
cookie engine was not enabled it will enable its cookie engine.  Passing a
magic string \&"ALL" will erase all cookies known by cURL. (Added in 7.14.1)
Passing the special string \&"SESS" will only erase all session cookies known
by cURL. (Added in 7.15.4)
.IP CURLOPT_HTTPGET
Pass a long. If the long is non-zero, this forces the HTTP request to get back
to GET. usable if a POST, HEAD, PUT or a custom request have been used
+153 −101
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
 *                            | (__| |_| |  _ <| |___
 *                             \___|\___/|_| \_\_____|
 *
 * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
 * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution. The terms
@@ -795,6 +795,19 @@ struct Cookie *Curl_cookie_getlist(struct CookieInfo *c,
  return mainco; /* return the new list */
}

/*****************************************************************************
 *
 * Curl_cookie_clearall()
 *
 * Clear all existing cookies and reset the counter.
 *
 ****************************************************************************/
void Curl_cookie_clearall(struct CookieInfo *cookies)
{
  Curl_cookie_freelist(cookies->cookies);
  cookies->cookies = NULL;
  cookies->numcookies = 0;
}

/*****************************************************************************
 *
@@ -817,6 +830,45 @@ void Curl_cookie_freelist(struct Cookie *co)
  }
}


/*****************************************************************************
 *
 * Curl_cookie_clearsess()
 *
 * Free all session cookies in the cookies list.
 *
 ****************************************************************************/
void Curl_cookie_clearsess(struct CookieInfo *cookies)
{
  struct Cookie *first, *curr, *next, *prev = NULL;

  if(!cookies->cookies)
    return;

  first = curr = prev = cookies->cookies;

  for(; curr; curr = next) {
    next = curr->next;
    if(!curr->expires) {
      if(first == curr)
        first = next;

      if(prev == curr)
        prev = next;
      else
        prev->next = next;

      free(curr);
      cookies->numcookies--;
    }
    else
      prev = curr;
  }

  cookies->cookies = first;
}


/*****************************************************************************
 *
 * Curl_cookie_cleanup()
+3 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
 *                            | (__| |_| |  _ <| |___
 *                             \___|\___/|_| \_\_____|
 *
 * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
 * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution. The terms
@@ -89,6 +89,8 @@ struct CookieInfo *Curl_cookie_init(struct SessionHandle *data,
                                    char *, struct CookieInfo *, bool);
struct Cookie *Curl_cookie_getlist(struct CookieInfo *, char *, char *, bool);
void Curl_cookie_freelist(struct Cookie *);
void Curl_cookie_clearall(struct CookieInfo *cookies);
void Curl_cookie_clearsess(struct CookieInfo *cookies);
void Curl_cookie_cleanup(struct CookieInfo *);
int Curl_cookie_output(struct CookieInfo *, char *);

Loading