aboutsummaryrefslogtreecommitdiffstats
path: root/src/tool_getparam.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tool_getparam.c')
-rw-r--r--src/tool_getparam.c59
1 files changed, 35 insertions, 24 deletions
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index b7ee519..12e3abd 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -188,6 +188,7 @@ static const struct LongShort aliases[]= {
{"$W", "abstract-unix-socket", ARG_STRING},
{"$X", "tls-max", ARG_STRING},
{"$Y", "suppress-connect-headers", ARG_BOOL},
+ {"$Z", "compressed-ssh", ARG_BOOL},
{"0", "http1.0", ARG_NONE},
{"01", "http1.1", ARG_NONE},
{"02", "http2", ARG_NONE},
@@ -448,7 +449,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
if(('-' != flag[0]) ||
(('-' == flag[0]) && ('-' == flag[1]))) {
/* this should be a long name */
- const char *word = ('-' == flag[0]) ? flag+2 : flag;
+ const char *word = ('-' == flag[0]) ? flag + 2 : flag;
size_t fnam = strlen(word);
int numhits = 0;
@@ -491,7 +492,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
if(!longopt) {
letter = (char)*parse;
- subletter='\0';
+ subletter = '\0';
}
else {
letter = parse[0];
@@ -590,7 +591,11 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
{
/* We support G, M, K too */
char *unit;
- curl_off_t value = curlx_strtoofft(nextarg, &unit, 0);
+ curl_off_t value;
+ if(curlx_strtoofft(nextarg, &unit, 0, &value)) {
+ warnf(global, "unsupported rate\n");
+ return PARAM_BAD_USE;
+ }
if(!*unit)
unit = (char *)"b";
@@ -782,7 +787,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
url = config->url_get;
else
/* there was no free node, create one! */
- url = new_getout(config);
+ config->url_get = url = new_getout(config);
if(!url)
return PARAM_NO_MEM;
@@ -999,7 +1004,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
#ifdef USE_METALINK
int mlmaj, mlmin, mlpatch;
metalink_get_version(&mlmaj, &mlmin, &mlpatch);
- if((mlmaj*10000)+(mlmin*100)+mlpatch < CURL_REQ_LIBMETALINK_VERS) {
+ if((mlmaj*10000)+(mlmin*100) + mlpatch < CURL_REQ_LIBMETALINK_VERS) {
warnf(global,
"--metalink option cannot be used because the version of "
"the linked libmetalink library is too old. "
@@ -1072,6 +1077,9 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
case 'Y': /* --suppress-connect-headers */
config->suppress_connect_headers = toggle;
break;
+ case 'Z': /* --compressed-ssh */
+ config->ssh_compression = toggle;
+ break;
}
break;
case '#': /* --progress-bar */
@@ -1182,7 +1190,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
config->resume_from_current = TRUE;
config->resume_from = 0;
}
- config->use_resume=TRUE;
+ config->use_resume = TRUE;
break;
case 'd':
/* postfield data */
@@ -1346,11 +1354,11 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
memcpy(config->postfields, oldpost, (size_t)oldlen);
/* use byte value 0x26 for '&' to accommodate non-ASCII platforms */
config->postfields[oldlen] = '\x26';
- memcpy(&config->postfields[oldlen+1], postdata, size);
- config->postfields[oldlen+1+size] = '\0';
+ memcpy(&config->postfields[oldlen + 1], postdata, size);
+ config->postfields[oldlen + 1 + size] = '\0';
Curl_safefree(oldpost);
Curl_safefree(postdata);
- config->postfieldsize += size+1;
+ config->postfieldsize += size + 1;
}
else {
config->postfields = postdata;
@@ -1598,11 +1606,11 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
to sort this out slowly and carefully */
if(formparse(config,
nextarg,
- &config->httppost,
- &config->last_post,
- (subletter=='s')?TRUE:FALSE)) /* 's' means literal string */
+ &config->mimepost,
+ &config->mimecurrent,
+ (subletter == 's')?TRUE:FALSE)) /* 's' is literal string */
return PARAM_BAD_USE;
- if(SetHTTPrequest(config, HTTPREQ_FORMPOST, &config->httpreq))
+ if(SetHTTPrequest(config, HTTPREQ_MIMEPOST, &config->httpreq))
return PARAM_BAD_USE;
break;
@@ -1779,7 +1787,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
url = config->url_out;
else
/* there was no free node, create one! */
- url = new_getout(config);
+ config->url_out = url = new_getout(config);
if(!url)
return PARAM_NO_MEM;
@@ -1843,10 +1851,13 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
if(ISDIGIT(*nextarg) && !strchr(nextarg, '-')) {
char buffer[32];
curl_off_t off;
+ if(curlx_strtoofft(nextarg, NULL, 10, &off)) {
+ warnf(global, "unsupported range point\n");
+ return PARAM_BAD_USE;
+ }
warnf(global,
"A specified range MUST include at least one dash (-). "
"Appending one for you!\n");
- off = curlx_strtoofft(nextarg, NULL, 10);
snprintf(buffer, sizeof(buffer), "%" CURL_FORMAT_CURL_OFF_T "-", off);
Curl_safefree(config->range);
config->range = strdup(buffer);
@@ -1901,23 +1912,23 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
/* we are uploading */
{
struct getout *url;
- if(!config->url_out)
- config->url_out = config->url_list;
- if(config->url_out) {
+ if(!config->url_ul)
+ config->url_ul = config->url_list;
+ if(config->url_ul) {
/* there's a node here, if it already is filled-in continue to find
an "empty" node */
- while(config->url_out && (config->url_out->flags & GETOUT_UPLOAD))
- config->url_out = config->url_out->next;
+ while(config->url_ul && (config->url_ul->flags & GETOUT_UPLOAD))
+ config->url_ul = config->url_ul->next;
}
/* now there might or might not be an available node to fill in! */
- if(config->url_out)
+ if(config->url_ul)
/* existing node */
- url = config->url_out;
+ url = config->url_ul;
else
/* there was no free node, create one! */
- url = new_getout(config);
+ config->url_ul = url = new_getout(config);
if(!url)
return PARAM_NO_MEM;
@@ -2042,7 +2053,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
break;
}
now = time(NULL);
- config->condtime=curl_getdate(nextarg, &now);
+ config->condtime = curl_getdate(nextarg, &now);
if(-1 == (int)config->condtime) {
/* now let's see if it is a file name to get the time from instead! */
struct_stat statbuf;