From 78dd08378804de519f8a5e0d79bbc1b06bcedad4 Mon Sep 17 00:00:00 2001 From: Stefan Eissing Date: Mon, 2 Jun 2025 12:12:13 +0200 Subject: [PATCH] curl: upload from '.' fix CURLOPT_NOPROGRESS is being set twice, if a file is uploaded from '.'. Fix order of options so that '.' can override the global setting. Without this, the `tool_readbusy_cb()` is never inoked and cannot unpause a transfer waiting for more input. Fixes #17513 Reported-by: denandz on github Closes #17517 --- src/config2setopts.c | 24 ++++++++++++++++-------- tests/data/test1400 | 4 ++-- tests/data/test1401 | 4 ++-- tests/data/test1402 | 4 ++-- tests/data/test1403 | 4 ++-- tests/data/test1404 | 4 ++-- tests/data/test1405 | 4 ++-- tests/data/test1406 | 4 ++-- tests/data/test1407 | 4 ++-- tests/data/test1420 | 4 ++-- tests/data/test1465 | 4 ++-- tests/data/test1481 | 4 ++-- 12 files changed, 38 insertions(+), 30 deletions(-) diff --git a/src/config2setopts.c b/src/config2setopts.c index f820637ab2..d7a4187a8b 100644 --- a/src/config2setopts.c +++ b/src/config2setopts.c @@ -640,13 +640,24 @@ static CURLcode ftp_setopts(struct GlobalConfig *global, return CURLE_OK; } +static void gen_trace_setopts(struct GlobalConfig *global, + struct OperationConfig *config, + CURL *curl) +{ + if(global->tracetype != TRACE_NONE) { + my_setopt(curl, CURLOPT_DEBUGFUNCTION, tool_debug_cb); + my_setopt(curl, CURLOPT_DEBUGDATA, config); + my_setopt_long(curl, CURLOPT_VERBOSE, 1L); + } +} + static void gen_cb_setopts(struct GlobalConfig *global, struct OperationConfig *config, struct per_transfer *per, CURL *curl) { (void) global; /* for builds without --libcurl */ - + (void) config; /* where to store */ my_setopt(curl, CURLOPT_WRITEDATA, per); my_setopt(curl, CURLOPT_INTERLEAVEDATA, per); @@ -678,12 +689,6 @@ static void gen_cb_setopts(struct GlobalConfig *global, my_setopt(curl, CURLOPT_XFERINFODATA, per); } - if(global->tracetype != TRACE_NONE) { - my_setopt(curl, CURLOPT_DEBUGFUNCTION, tool_debug_cb); - my_setopt(curl, CURLOPT_DEBUGDATA, config); - my_setopt_long(curl, CURLOPT_VERBOSE, 1L); - } - my_setopt(curl, CURLOPT_HEADERFUNCTION, tool_header_cb); my_setopt(curl, CURLOPT_HEADERDATA, per); } @@ -799,7 +804,7 @@ CURLcode config2setopts(struct GlobalConfig *global, return result; #endif - gen_cb_setopts(global, config, per, curl); + gen_trace_setopts(global, config, curl); { #ifdef DEBUGBUILD @@ -822,6 +827,9 @@ CURLcode config2setopts(struct GlobalConfig *global, my_setopt_str(curl, CURLOPT_URL, per->url); my_setopt_long(curl, CURLOPT_NOPROGRESS, global->noprogress || global->silent); + /* call after the line above. It may override CURLOPT_NOPROGRESS */ + gen_cb_setopts(global, config, per, curl); + if(config->no_body) my_setopt_long(curl, CURLOPT_NOBODY, 1); diff --git a/tests/data/test1400 b/tests/data/test1400 index e6cb294083..190a09338e 100644 --- a/tests/data/test1400 +++ b/tests/data/test1400 @@ -82,14 +82,14 @@ int main(int argc, char *argv[]) as source easily. You may choose to either not use them or implement them yourself. + CURLOPT_DEBUGFUNCTION was set to a function pointer + CURLOPT_DEBUGDATA was set to an object pointer CURLOPT_WRITEDATA was set to an object pointer CURLOPT_WRITEFUNCTION was set to a function pointer CURLOPT_READDATA was set to an object pointer CURLOPT_READFUNCTION was set to a function pointer CURLOPT_SEEKDATA was set to an object pointer CURLOPT_SEEKFUNCTION was set to a function pointer - CURLOPT_DEBUGFUNCTION was set to a function pointer - CURLOPT_DEBUGDATA was set to an object pointer CURLOPT_HEADERFUNCTION was set to a function pointer CURLOPT_HEADERDATA was set to an object pointer CURLOPT_ERRORBUFFER was set to an object pointer diff --git a/tests/data/test1401 b/tests/data/test1401 index 573125e7c6..38b3291bab 100644 --- a/tests/data/test1401 +++ b/tests/data/test1401 @@ -101,14 +101,14 @@ int main(int argc, char *argv[]) as source easily. You may choose to either not use them or implement them yourself. + CURLOPT_DEBUGFUNCTION was set to a function pointer + CURLOPT_DEBUGDATA was set to an object pointer CURLOPT_WRITEDATA was set to an object pointer CURLOPT_WRITEFUNCTION was set to a function pointer CURLOPT_READDATA was set to an object pointer CURLOPT_READFUNCTION was set to a function pointer CURLOPT_SEEKDATA was set to an object pointer CURLOPT_SEEKFUNCTION was set to a function pointer - CURLOPT_DEBUGFUNCTION was set to a function pointer - CURLOPT_DEBUGDATA was set to an object pointer CURLOPT_HEADERFUNCTION was set to a function pointer CURLOPT_HEADERDATA was set to an object pointer CURLOPT_ERRORBUFFER was set to an object pointer diff --git a/tests/data/test1402 b/tests/data/test1402 index 62842dc5d8..fe81e45f3f 100644 --- a/tests/data/test1402 +++ b/tests/data/test1402 @@ -87,14 +87,14 @@ int main(int argc, char *argv[]) as source easily. You may choose to either not use them or implement them yourself. + CURLOPT_DEBUGFUNCTION was set to a function pointer + CURLOPT_DEBUGDATA was set to an object pointer CURLOPT_WRITEDATA was set to an object pointer CURLOPT_WRITEFUNCTION was set to a function pointer CURLOPT_READDATA was set to an object pointer CURLOPT_READFUNCTION was set to a function pointer CURLOPT_SEEKDATA was set to an object pointer CURLOPT_SEEKFUNCTION was set to a function pointer - CURLOPT_DEBUGFUNCTION was set to a function pointer - CURLOPT_DEBUGDATA was set to an object pointer CURLOPT_HEADERFUNCTION was set to a function pointer CURLOPT_HEADERDATA was set to an object pointer CURLOPT_ERRORBUFFER was set to an object pointer diff --git a/tests/data/test1403 b/tests/data/test1403 index a0ddf86df1..1141a200cf 100644 --- a/tests/data/test1403 +++ b/tests/data/test1403 @@ -82,14 +82,14 @@ int main(int argc, char *argv[]) as source easily. You may choose to either not use them or implement them yourself. + CURLOPT_DEBUGFUNCTION was set to a function pointer + CURLOPT_DEBUGDATA was set to an object pointer CURLOPT_WRITEDATA was set to an object pointer CURLOPT_WRITEFUNCTION was set to a function pointer CURLOPT_READDATA was set to an object pointer CURLOPT_READFUNCTION was set to a function pointer CURLOPT_SEEKDATA was set to an object pointer CURLOPT_SEEKFUNCTION was set to a function pointer - CURLOPT_DEBUGFUNCTION was set to a function pointer - CURLOPT_DEBUGDATA was set to an object pointer CURLOPT_HEADERFUNCTION was set to a function pointer CURLOPT_HEADERDATA was set to an object pointer CURLOPT_ERRORBUFFER was set to an object pointer diff --git a/tests/data/test1404 b/tests/data/test1404 index aa2e7f5bae..2127441f15 100644 --- a/tests/data/test1404 +++ b/tests/data/test1404 @@ -157,14 +157,14 @@ int main(int argc, char *argv[]) as source easily. You may choose to either not use them or implement them yourself. + CURLOPT_DEBUGFUNCTION was set to a function pointer + CURLOPT_DEBUGDATA was set to an object pointer CURLOPT_WRITEDATA was set to an object pointer CURLOPT_WRITEFUNCTION was set to a function pointer CURLOPT_READDATA was set to an object pointer CURLOPT_READFUNCTION was set to a function pointer CURLOPT_SEEKDATA was set to an object pointer CURLOPT_SEEKFUNCTION was set to a function pointer - CURLOPT_DEBUGFUNCTION was set to a function pointer - CURLOPT_DEBUGDATA was set to an object pointer CURLOPT_HEADERFUNCTION was set to a function pointer CURLOPT_HEADERDATA was set to an object pointer CURLOPT_ERRORBUFFER was set to an object pointer diff --git a/tests/data/test1405 b/tests/data/test1405 index 47d2569f66..cfed433d92 100644 --- a/tests/data/test1405 +++ b/tests/data/test1405 @@ -102,14 +102,14 @@ int main(int argc, char *argv[]) as source easily. You may choose to either not use them or implement them yourself. + CURLOPT_DEBUGFUNCTION was set to a function pointer + CURLOPT_DEBUGDATA was set to an object pointer CURLOPT_WRITEDATA was set to an object pointer CURLOPT_WRITEFUNCTION was set to a function pointer CURLOPT_READDATA was set to an object pointer CURLOPT_READFUNCTION was set to a function pointer CURLOPT_SEEKDATA was set to an object pointer CURLOPT_SEEKFUNCTION was set to a function pointer - CURLOPT_DEBUGFUNCTION was set to a function pointer - CURLOPT_DEBUGDATA was set to an object pointer CURLOPT_HEADERFUNCTION was set to a function pointer CURLOPT_HEADERDATA was set to an object pointer CURLOPT_ERRORBUFFER was set to an object pointer diff --git a/tests/data/test1406 b/tests/data/test1406 index 7b2c88366d..87b1615318 100644 --- a/tests/data/test1406 +++ b/tests/data/test1406 @@ -93,14 +93,14 @@ int main(int argc, char *argv[]) as source easily. You may choose to either not use them or implement them yourself. + CURLOPT_DEBUGFUNCTION was set to a function pointer + CURLOPT_DEBUGDATA was set to an object pointer CURLOPT_WRITEDATA was set to an object pointer CURLOPT_WRITEFUNCTION was set to a function pointer CURLOPT_READDATA was set to an object pointer CURLOPT_READFUNCTION was set to a function pointer CURLOPT_SEEKDATA was set to an object pointer CURLOPT_SEEKFUNCTION was set to a function pointer - CURLOPT_DEBUGFUNCTION was set to a function pointer - CURLOPT_DEBUGDATA was set to an object pointer CURLOPT_HEADERFUNCTION was set to a function pointer CURLOPT_HEADERDATA was set to an object pointer CURLOPT_ERRORBUFFER was set to an object pointer diff --git a/tests/data/test1407 b/tests/data/test1407 index ccf6bdd50b..4cf5629a84 100644 --- a/tests/data/test1407 +++ b/tests/data/test1407 @@ -73,14 +73,14 @@ int main(int argc, char *argv[]) as source easily. You may choose to either not use them or implement them yourself. + CURLOPT_DEBUGFUNCTION was set to a function pointer + CURLOPT_DEBUGDATA was set to an object pointer CURLOPT_WRITEDATA was set to an object pointer CURLOPT_WRITEFUNCTION was set to a function pointer CURLOPT_READDATA was set to an object pointer CURLOPT_READFUNCTION was set to a function pointer CURLOPT_SEEKDATA was set to an object pointer CURLOPT_SEEKFUNCTION was set to a function pointer - CURLOPT_DEBUGFUNCTION was set to a function pointer - CURLOPT_DEBUGDATA was set to an object pointer CURLOPT_HEADERFUNCTION was set to a function pointer CURLOPT_HEADERDATA was set to an object pointer CURLOPT_ERRORBUFFER was set to an object pointer diff --git a/tests/data/test1420 b/tests/data/test1420 index b3f5473d94..d334516d07 100644 --- a/tests/data/test1420 +++ b/tests/data/test1420 @@ -78,14 +78,14 @@ int main(int argc, char *argv[]) as source easily. You may choose to either not use them or implement them yourself. + CURLOPT_DEBUGFUNCTION was set to a function pointer + CURLOPT_DEBUGDATA was set to an object pointer CURLOPT_WRITEDATA was set to an object pointer CURLOPT_WRITEFUNCTION was set to a function pointer CURLOPT_READDATA was set to an object pointer CURLOPT_READFUNCTION was set to a function pointer CURLOPT_SEEKDATA was set to an object pointer CURLOPT_SEEKFUNCTION was set to a function pointer - CURLOPT_DEBUGFUNCTION was set to a function pointer - CURLOPT_DEBUGDATA was set to an object pointer CURLOPT_HEADERFUNCTION was set to a function pointer CURLOPT_HEADERDATA was set to an object pointer CURLOPT_ERRORBUFFER was set to an object pointer diff --git a/tests/data/test1465 b/tests/data/test1465 index 265f83d439..53592cc1fb 100644 --- a/tests/data/test1465 +++ b/tests/data/test1465 @@ -90,14 +90,14 @@ int main(int argc, char *argv[]) as source easily. You may choose to either not use them or implement them yourself. + CURLOPT_DEBUGFUNCTION was set to a function pointer + CURLOPT_DEBUGDATA was set to an object pointer CURLOPT_WRITEDATA was set to an object pointer CURLOPT_WRITEFUNCTION was set to a function pointer CURLOPT_READDATA was set to an object pointer CURLOPT_READFUNCTION was set to a function pointer CURLOPT_SEEKDATA was set to an object pointer CURLOPT_SEEKFUNCTION was set to a function pointer - CURLOPT_DEBUGFUNCTION was set to a function pointer - CURLOPT_DEBUGDATA was set to an object pointer CURLOPT_HEADERFUNCTION was set to a function pointer CURLOPT_HEADERDATA was set to an object pointer CURLOPT_ERRORBUFFER was set to an object pointer diff --git a/tests/data/test1481 b/tests/data/test1481 index 1ebc0c7465..85fc8359bd 100644 --- a/tests/data/test1481 +++ b/tests/data/test1481 @@ -88,14 +88,14 @@ int main(int argc, char *argv[]) as source easily. You may choose to either not use them or implement them yourself. + CURLOPT_DEBUGFUNCTION was set to a function pointer + CURLOPT_DEBUGDATA was set to an object pointer CURLOPT_WRITEDATA was set to an object pointer CURLOPT_WRITEFUNCTION was set to a function pointer CURLOPT_READDATA was set to an object pointer CURLOPT_READFUNCTION was set to a function pointer CURLOPT_SEEKDATA was set to an object pointer CURLOPT_SEEKFUNCTION was set to a function pointer - CURLOPT_DEBUGFUNCTION was set to a function pointer - CURLOPT_DEBUGDATA was set to an object pointer CURLOPT_HEADERFUNCTION was set to a function pointer CURLOPT_HEADERDATA was set to an object pointer CURLOPT_ERRORBUFFER was set to an object pointer -- 2.47.3