From 7a46aeb0be3fa00826b0c47a8bc06eddff448659 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 13 Nov 2019 11:33:29 +0100 Subject: curl: fix -T globbing Regression from e59371a4936f8 (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 --- src/tool_operate.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/tool_operate.c b/src/tool_operate.c index 3087d2d14..4ecb1ed5f 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -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 -- cgit v1.2.3