From c13dbf7baee0f57c8ff6fb3907b7572c9102c315 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 29 Aug 2001 09:32:35 +0000 Subject: uses the new cookie jar feature --- src/main.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index bb63527d1..1a1aedae2 100644 --- a/src/main.c +++ b/src/main.c @@ -301,7 +301,8 @@ static void help(void) " -b/--cookie Cookie string or file to read cookies from (H)\n" " -B/--use-ascii Use ASCII/text transfer\n", curl_version()); - puts(" -C/--continue-at Specify absolute resume offset\n" + puts(" -c/--cookie-jar Write all cookies to this file after operation (H)\n" + " -C/--continue-at Specify absolute resume offset\n" " -d/--data HTTP POST data (H)\n" " --data-ascii HTTP POST ASCII data (H)\n" " --data-binary HTTP POST binary data (H)\n" @@ -314,9 +315,9 @@ static void help(void) " -f/--fail Fail silently (no output at all) on errors (H)\n" " -F/--form Specify HTTP POST data (H)\n" " -g/--globoff Disable URL sequences and ranges using {} and []\n" - " -G/--get Send the -d data with a HTTP GET (H)\n"); + " -G/--get Send the -d data with a HTTP GET (H)"); puts(" -h/--help This help text\n" - " -H/--header Custom header to pass to server. (H)" + " -H/--header Custom header to pass to server. (H)\n" " -i/--include Include the HTTP-header in the output (H)\n" " -I/--head Fetch document info only (HTTP HEAD/FTP SIZE)\n" " --interface Specify the interface to be used\n" @@ -369,7 +370,9 @@ struct Configurable { char *random_file; char *egd_file; char *useragent; - char *cookie; + char *cookie; /* single line with specified cookies */ + char *cookiejar; /* write to this file */ + char *cookiefile; /* read from this file */ bool use_resume; bool resume_from_current; int resume_from; @@ -405,7 +408,6 @@ struct Configurable { char *cacert; char *cert_passwd; bool crlf; - char *cookiefile; char *customrequest; char *krb4level; bool progressmode; @@ -601,7 +603,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ {"b", "cookie", TRUE}, {"B", "ftp-ascii", FALSE}, /* this long format is OBSOLETE now! */ {"B", "use-ascii", FALSE}, - {"c", "continue", FALSE}, + {"c", "cookie-jar", TRUE}, {"C", "continue-at", TRUE}, {"d", "data", TRUE}, {"da", "data-ascii", TRUE}, @@ -816,9 +818,8 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ config->conf ^= CONF_GETTEXT; break; case 'c': - /* This makes us continue an ftp transfer */ - config->use_resume^=TRUE; - fprintf(stderr, "-c is a deprecated switch, use '-C -' instead!\n"); + /* get the file name to dump all cookies in */ + GetStr(&config->cookiejar, nextarg); break; case 'C': /* This makes us continue an ftp transfer at given position */ @@ -1982,6 +1983,8 @@ operate(struct Configurable *config, int argc, char *argv[]) curl_easy_setopt(curl, CURLOPT_WRITEHEADER, config->headerfile?&heads:NULL); curl_easy_setopt(curl, CURLOPT_COOKIEFILE, config->cookiefile); + /* cookie jar was added in 7.9 */ + curl_easy_setopt(curl, CURLOPT_COOKIEJAR, config->cookiejar); curl_easy_setopt(curl, CURLOPT_SSLVERSION, config->ssl_version); curl_easy_setopt(curl, CURLOPT_TIMECONDITION, config->timecond); curl_easy_setopt(curl, CURLOPT_TIMEVALUE, config->condtime); -- cgit v1.2.3