Loading include/curl/curl.h +10 −2 Original line number Diff line number Diff line Loading @@ -538,9 +538,17 @@ typedef enum { /* set the data for the debug function */ CINIT(DEBUGDATA, OBJECTPOINT, 95), /* mark this as start of a cookie session */ CINIT(COOKIESESSION, LONG, 96), CURLOPT_LASTENTRY /* the last unusued */ } CURLoption; /* two convenient "aliases" that follow the name scheme better */ #define CURLOPT_WRITEDATA CURLOPT_FILE #define CURLOPT_READDATA CURLOPT_INFILE /* These enums are for use with the CURLOPT_HTTP_VERSION option. */ enum { CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd Loading Loading @@ -676,8 +684,8 @@ CURLcode curl_global_init(long flags); void curl_global_cleanup(void); /* This is the version number */ #define LIBCURL_VERSION "7.9.6" #define LIBCURL_VERSION_NUM 0x070906 #define LIBCURL_VERSION "7.9.7-pre1" #define LIBCURL_VERSION_NUM 0x070907 /* linked-list structure for the CURLOPT_QUOTE option (and other) */ struct curl_slist { Loading lib/cookie.c +31 −13 Original line number Diff line number Diff line Loading @@ -93,6 +93,21 @@ Example set of cookies: #include "memdebug.h" #endif static void free_cookiemess(struct Cookie *co) { if(co->domain) free(co->domain); if(co->path) free(co->path); if(co->name) free(co->name); if(co->value) free(co->value); free(co); } /**************************************************************************** * * Curl_cookie_add() Loading Loading @@ -326,22 +341,19 @@ Curl_cookie_add(struct CookieInfo *c, if(7 != fields) { /* we did not find the sufficient number of fields to recognize this as a valid line, abort and go home */ if(co->domain) free(co->domain); if(co->path) free(co->path); if(co->name) free(co->name); if(co->value) free(co->value); free(co); free_cookiemess(co); return NULL; } } if(!c->running && /* read from a file */ c->newsession && /* clean session cookies */ !co->expires) { /* this is a session cookie since it doesn't expire! */ free_cookiemess(co); return NULL; } co->livecookie = c->running; /* now, we have parsed the incoming line, we must now check if this Loading Loading @@ -462,8 +474,12 @@ Curl_cookie_add(struct CookieInfo *c, * Inits a cookie struct to read data from a local file. This is always * called before any cookies are set. File may be NULL. * * If 'newsession' is TRUE, discard all "session cookies" on read from file. * ****************************************************************************/ struct CookieInfo *Curl_cookie_init(char *file, struct CookieInfo *inc) struct CookieInfo *Curl_cookie_init(char *file, struct CookieInfo *inc, bool newsession) { char line[MAX_COOKIE_LINE]; struct CookieInfo *c; Loading Loading @@ -491,6 +507,8 @@ struct CookieInfo *Curl_cookie_init(char *file, struct CookieInfo *inc) else fp = file?fopen(file, "r"):NULL; c->newsession = newsession; /* new session? */ if(fp) { char *lineptr; bool headerline; Loading lib/cookie.h +4 −3 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ struct CookieInfo { char *filename; /* file we read from/write to */ bool running; /* state info, for cookie adding information */ long numcookies; /* number of cookies in the "jar" */ bool newsession; /* new session, discard session cookies on load */ }; /* This is the maximum line length we accept for a cookie line */ Loading @@ -75,7 +76,7 @@ struct CookieInfo { struct Cookie *Curl_cookie_add(struct CookieInfo *, bool header, char *line, char *domain); struct CookieInfo *Curl_cookie_init(char *, struct CookieInfo *); struct CookieInfo *Curl_cookie_init(char *, struct CookieInfo *, bool); struct Cookie *Curl_cookie_getlist(struct CookieInfo *, char *, char *, bool); void Curl_cookie_freelist(struct Cookie *); void Curl_cookie_cleanup(struct CookieInfo *); Loading lib/easy.c +2 −1 Original line number Diff line number Diff line Loading @@ -312,7 +312,8 @@ CURL *curl_easy_duphandle(CURL *incurl) /* If cookies are enabled in the parent handle, we enable them in the clone as well! */ outcurl->cookies = Curl_cookie_init(data->cookies->filename, outcurl->cookies); outcurl->cookies, data->set.cookiesession); /* duplicate all values in 'change' */ if(data->change.url) { Loading lib/url.c +23 −2 Original line number Diff line number Diff line Loading @@ -495,13 +495,33 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...) data->set.ssl.version = va_arg(param, long); break; case CURLOPT_COOKIESESSION: /* * Set this option to TRUE to start a new "cookie session". It will * prevent the forthcoming read-cookies-from-file actions to accept * cookies that are marked as being session cookies, as they belong to a * previous session. * * In the original Netscape cookie spec, "session cookies" are cookies * with no expire date set. RFC2109 describes the same action if no * 'Max-Age' is set and RFC2965 includes the RFC2109 description and adds * a 'Discard' action that can enforce the discard even for cookies that * have a Max-Age. * * We run mostly with the original cookie spec, as hardly anyone implements * anything else. */ data->set.cookiesession = (bool)va_arg(param, long); break; case CURLOPT_COOKIEFILE: /* * Set cookie file to read and parse. Can be used multiple times. */ cookiefile = (char *)va_arg(param, void *); if(cookiefile) data->cookies = Curl_cookie_init(cookiefile, data->cookies); data->cookies = Curl_cookie_init(cookiefile, data->cookies, data->set.cookiesession); break; case CURLOPT_COOKIEJAR: Loading @@ -514,7 +534,8 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...) * Activate the cookie parser. This may or may not already * have been made. */ data->cookies = Curl_cookie_init(NULL, data->cookies); data->cookies = Curl_cookie_init(NULL, data->cookies, data->set.cookiesession); break; case CURLOPT_WRITEHEADER: /* Loading Loading
include/curl/curl.h +10 −2 Original line number Diff line number Diff line Loading @@ -538,9 +538,17 @@ typedef enum { /* set the data for the debug function */ CINIT(DEBUGDATA, OBJECTPOINT, 95), /* mark this as start of a cookie session */ CINIT(COOKIESESSION, LONG, 96), CURLOPT_LASTENTRY /* the last unusued */ } CURLoption; /* two convenient "aliases" that follow the name scheme better */ #define CURLOPT_WRITEDATA CURLOPT_FILE #define CURLOPT_READDATA CURLOPT_INFILE /* These enums are for use with the CURLOPT_HTTP_VERSION option. */ enum { CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd Loading Loading @@ -676,8 +684,8 @@ CURLcode curl_global_init(long flags); void curl_global_cleanup(void); /* This is the version number */ #define LIBCURL_VERSION "7.9.6" #define LIBCURL_VERSION_NUM 0x070906 #define LIBCURL_VERSION "7.9.7-pre1" #define LIBCURL_VERSION_NUM 0x070907 /* linked-list structure for the CURLOPT_QUOTE option (and other) */ struct curl_slist { Loading
lib/cookie.c +31 −13 Original line number Diff line number Diff line Loading @@ -93,6 +93,21 @@ Example set of cookies: #include "memdebug.h" #endif static void free_cookiemess(struct Cookie *co) { if(co->domain) free(co->domain); if(co->path) free(co->path); if(co->name) free(co->name); if(co->value) free(co->value); free(co); } /**************************************************************************** * * Curl_cookie_add() Loading Loading @@ -326,22 +341,19 @@ Curl_cookie_add(struct CookieInfo *c, if(7 != fields) { /* we did not find the sufficient number of fields to recognize this as a valid line, abort and go home */ if(co->domain) free(co->domain); if(co->path) free(co->path); if(co->name) free(co->name); if(co->value) free(co->value); free(co); free_cookiemess(co); return NULL; } } if(!c->running && /* read from a file */ c->newsession && /* clean session cookies */ !co->expires) { /* this is a session cookie since it doesn't expire! */ free_cookiemess(co); return NULL; } co->livecookie = c->running; /* now, we have parsed the incoming line, we must now check if this Loading Loading @@ -462,8 +474,12 @@ Curl_cookie_add(struct CookieInfo *c, * Inits a cookie struct to read data from a local file. This is always * called before any cookies are set. File may be NULL. * * If 'newsession' is TRUE, discard all "session cookies" on read from file. * ****************************************************************************/ struct CookieInfo *Curl_cookie_init(char *file, struct CookieInfo *inc) struct CookieInfo *Curl_cookie_init(char *file, struct CookieInfo *inc, bool newsession) { char line[MAX_COOKIE_LINE]; struct CookieInfo *c; Loading Loading @@ -491,6 +507,8 @@ struct CookieInfo *Curl_cookie_init(char *file, struct CookieInfo *inc) else fp = file?fopen(file, "r"):NULL; c->newsession = newsession; /* new session? */ if(fp) { char *lineptr; bool headerline; Loading
lib/cookie.h +4 −3 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ struct CookieInfo { char *filename; /* file we read from/write to */ bool running; /* state info, for cookie adding information */ long numcookies; /* number of cookies in the "jar" */ bool newsession; /* new session, discard session cookies on load */ }; /* This is the maximum line length we accept for a cookie line */ Loading @@ -75,7 +76,7 @@ struct CookieInfo { struct Cookie *Curl_cookie_add(struct CookieInfo *, bool header, char *line, char *domain); struct CookieInfo *Curl_cookie_init(char *, struct CookieInfo *); struct CookieInfo *Curl_cookie_init(char *, struct CookieInfo *, bool); struct Cookie *Curl_cookie_getlist(struct CookieInfo *, char *, char *, bool); void Curl_cookie_freelist(struct Cookie *); void Curl_cookie_cleanup(struct CookieInfo *); Loading
lib/easy.c +2 −1 Original line number Diff line number Diff line Loading @@ -312,7 +312,8 @@ CURL *curl_easy_duphandle(CURL *incurl) /* If cookies are enabled in the parent handle, we enable them in the clone as well! */ outcurl->cookies = Curl_cookie_init(data->cookies->filename, outcurl->cookies); outcurl->cookies, data->set.cookiesession); /* duplicate all values in 'change' */ if(data->change.url) { Loading
lib/url.c +23 −2 Original line number Diff line number Diff line Loading @@ -495,13 +495,33 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...) data->set.ssl.version = va_arg(param, long); break; case CURLOPT_COOKIESESSION: /* * Set this option to TRUE to start a new "cookie session". It will * prevent the forthcoming read-cookies-from-file actions to accept * cookies that are marked as being session cookies, as they belong to a * previous session. * * In the original Netscape cookie spec, "session cookies" are cookies * with no expire date set. RFC2109 describes the same action if no * 'Max-Age' is set and RFC2965 includes the RFC2109 description and adds * a 'Discard' action that can enforce the discard even for cookies that * have a Max-Age. * * We run mostly with the original cookie spec, as hardly anyone implements * anything else. */ data->set.cookiesession = (bool)va_arg(param, long); break; case CURLOPT_COOKIEFILE: /* * Set cookie file to read and parse. Can be used multiple times. */ cookiefile = (char *)va_arg(param, void *); if(cookiefile) data->cookies = Curl_cookie_init(cookiefile, data->cookies); data->cookies = Curl_cookie_init(cookiefile, data->cookies, data->set.cookiesession); break; case CURLOPT_COOKIEJAR: Loading @@ -514,7 +534,8 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...) * Activate the cookie parser. This may or may not already * have been made. */ data->cookies = Curl_cookie_init(NULL, data->cookies); data->cookies = Curl_cookie_init(NULL, data->cookies, data->set.cookiesession); break; case CURLOPT_WRITEHEADER: /* Loading