curl: fix -T globbing

Regression from e59371a493 (7.67.0)

Added test 490, 491 and 492 to verify the functionality.

Reported-by: Kamil Dudka
Reported-by: Anderson Sasaki

Fixes #4588
Closes #4591
This commit is contained in:
Daniel Stenberg 2019-11-13 11:33:29 +01:00
parent 674298d191
commit 7a46aeb0be
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 232 additions and 6 deletions

View file

@ -829,12 +829,6 @@ static CURLcode single_transfer(struct GlobalConfig *global,
separator = ((!state->outfiles ||
!strcmp(state->outfiles, "-")) && urlnum > 1);
/* Here's looping around each globbed URL */
if(state->li >= urlnum) {
state->li = 0;
state->up++;
}
if(state->up < state->infilenum) {
struct per_transfer *per;
struct OutStruct *outs;
@ -1908,6 +1902,15 @@ static CURLcode single_transfer(struct GlobalConfig *global,
per->retrystart = tvnow();
state->li++;
/* Here's looping around each globbed URL */
if(state->li >= urlnum) {
state->li = 0;
state->urlnum = 0; /* forced reglob of URLs */
glob_cleanup(state->urls);
state->urls = NULL;
state->up++;
Curl_safefree(state->uploadfile); /* clear it to get the next */
}
}
else {
/* Free this URL node data without destroying the