aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-10-17 13:11:00 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-10-17 13:11:00 +0000
commitce5db9a86ea1508b0caaeec38adc5397e390dc3e (patch)
treee932aecf231b6fb77a0e98a1acfcb8caa1d80b16 /src/main.c
parent94568f884dc30614f30918c9cca8cff40cc6c936 (diff)
Dominick Meglio implemented CURLOPT_MAXFILESIZE and --max-filesize.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 54b973775..5caf803df 100644
--- a/src/main.c
+++ b/src/main.c
@@ -428,6 +428,7 @@ static void help(void)
" following locations, even when hostname changed",
" -m/--max-time <seconds> Maximum time allowed for the transfer",
" --max-redirs <num> Set maximum number of redirections allowed (H)",
+ " --max-filesize <bytes> Set the maximum file size to download (H/F)",
" -M/--manual Display huge help text",
" -n/--netrc Must read .netrc for user name and password",
" --netrc-optional Use either .netrc or URL; overrides -n",
@@ -506,6 +507,7 @@ struct Configurable {
long timeout;
long connecttimeout;
long maxredirs;
+ long max_filesize;
char *headerfile;
char *ftpport;
char *iface;
@@ -1140,6 +1142,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
{"*v", "stderr", TRUE},
{"*w", "interface", TRUE},
{"*x", "krb4", TRUE},
+ {"*y", "max-filesize", TRUE},
{"0", "http1.0", FALSE},
{"1", "tlsv1", FALSE},
{"2", "sslv2", FALSE},
@@ -1406,6 +1409,9 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
/* krb4 level string */
GetStr(&config->krb4level, nextarg);
break;
+ case 'y': /* --max-filesize */
+ config->max_filesize = atoi(nextarg);
+ break;
default: /* the URL! */
{
@@ -3247,6 +3253,10 @@ operate(struct Configurable *config, int argc, char *argv[])
if(config->proxyntlm)
curl_easy_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_NTLM);
+ /* new in curl 7.10.8 */
+ if (config->max_filesize)
+ curl_easy_setopt(curl, CURLOPT_MAXFILESIZE, config->max_filesize);
+
res = curl_easy_perform(curl);
if((config->progressmode == CURL_PROGRESS_BAR) &&