'resume from'-fix. When using "-C -" and doing multiple file download, the

first resume was used on all files instead of being reset between each file.
As found by Bjrn Stenberg.
This commit is contained in:
Daniel Stenberg 2001-06-25 12:56:06 +00:00
parent cd4aed6690
commit 6f2fca53ad

View File

@ -309,6 +309,7 @@ struct Configurable {
char *useragent; char *useragent;
char *cookie; char *cookie;
bool use_resume; bool use_resume;
bool resume_from_current;
int resume_from; int resume_from;
char *postfields; char *postfields;
long postfieldsize; long postfieldsize;
@ -757,8 +758,14 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
break; break;
case 'C': case 'C':
/* This makes us continue an ftp transfer at given position */ /* This makes us continue an ftp transfer at given position */
if(!strequal(nextarg, "-")) if(!strequal(nextarg, "-")) {
config->resume_from= atoi(nextarg); config->resume_from= atoi(nextarg);
config->resume_from_current = FALSE;
}
else {
config->resume_from_current = TRUE;
config->resume_from = 0;
}
config->use_resume=TRUE; config->use_resume=TRUE;
break; break;
case 'd': case 'd':
@ -1639,7 +1646,7 @@ operate(struct Configurable *config, int argc, char *argv[])
free(storefile); free(storefile);
} }
if((0 == config->resume_from) && config->use_resume) { if(config->resume_from_current) {
/* we're told to continue where we are now, then we get the size of /* we're told to continue where we are now, then we get the size of
the file as it is now and open it for append instead */ the file as it is now and open it for append instead */
@ -1707,8 +1714,7 @@ operate(struct Configurable *config, int argc, char *argv[])
} }
if((config->conf&CONF_UPLOAD) && if((config->conf&CONF_UPLOAD) &&
config->use_resume && config->resume_from_current) {
(0==config->resume_from)) {
config->resume_from = -1; /* -1 will then force get-it-yourself */ config->resume_from = -1; /* -1 will then force get-it-yourself */
} }
if(config->headerfile) { if(config->headerfile) {