From bc01ad5b9e08358aa8dc684faa24af0246fcb055 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 24 Nov 2003 11:59:15 +0000 Subject: --ftp-ssl support added --- src/main.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index be805ce15..411639220 100644 --- a/src/main.c +++ b/src/main.c @@ -410,6 +410,7 @@ static void help(void) " --crlf Convert LF to CRLF in upload", " -f/--fail Fail silently (no output at all) on errors (H)", " --ftp-create-dirs Create the remote dirs if not present (F)", + " --ftp-ssl Enable SSL/TLS for the ftp transfer (F)", " -F/--form Specify HTTP multipart POST data (H)", " -g/--globoff Disable URL sequences and ranges using {} and []", " -G/--get Send the -d data with a HTTP GET (H)", @@ -591,6 +592,8 @@ struct Configurable { time_t lastrecvtime; size_t lastrecvsize; + + bool ftp_ssl; }; /* global variable to hold info about libcurl */ @@ -1153,8 +1156,8 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ boolean whether it takes an additional argument */ struct LongShort aliases[]= { - /* all these ones, starting with "*" as a short-option have *no* short - option to mention. */ + /* all these ones, starting with "*" or "$" as a short-option have *no* + short option to mention. */ {"*", "url", TRUE}, {"*a", "random-file", TRUE}, {"*b", "egd-file", TRUE}, @@ -1176,7 +1179,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ #ifdef __DJGPP__ {"*p", "wdebug", FALSE}, #endif - {"*q", "ftp-create-dirs", FALSE}, + {"*q", "ftp-create-dirs", FALSE}, {"*r", "create-dirs", FALSE}, {"*s", "max-redirs", TRUE}, {"*t", "proxy-ntlm", FALSE}, @@ -1186,6 +1189,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ {"*x", "krb4", TRUE}, {"*y", "max-filesize", TRUE}, {"*z", "disable-eprt", FALSE}, + {"$a", "ftp-ssl", FALSE}, {"0", "http1.0", FALSE}, {"1", "tlsv1", FALSE}, {"2", "sslv2", FALSE}, @@ -1495,6 +1499,13 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ } } break; + case '$': /* more options without a short option */ + switch(subletter) { + case 'a': /* --ftp-ssl */ + config->ftp_ssl ^= TRUE; + break; + } + break; case '#': /* added 19990617 larsa */ config->progressmode ^= CURL_PROGRESS_BAR; break; @@ -3285,9 +3296,13 @@ operate(struct Configurable *config, int argc, char *argv[]) curl_easy_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_NTLM); /* new in curl 7.10.8 */ - if (config->max_filesize) + if(config->max_filesize) curl_easy_setopt(curl, CURLOPT_MAXFILESIZE, config->max_filesize); + /* new in curl 7.10.9 */ + if(config->ftp_ssl) + curl_easy_setopt(curl, CURLOPT_FTP_SSL, CURLFTPSSL_TRY); + res = curl_easy_perform(curl); if((config->progressmode == CURL_PROGRESS_BAR) && -- cgit v1.2.3