]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl: upload from '.' fix
authorStefan Eissing <stefan@eissing.org>
Mon, 2 Jun 2025 10:12:13 +0000 (12:12 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 2 Jun 2025 10:49:38 +0000 (12:49 +0200)
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

12 files changed:
src/config2setopts.c
tests/data/test1400
tests/data/test1401
tests/data/test1402
tests/data/test1403
tests/data/test1404
tests/data/test1405
tests/data/test1406
tests/data/test1407
tests/data/test1420
tests/data/test1465
tests/data/test1481

index f820637ab279ab47947fd7645be0ea26c028c5f9..d7a4187a8bbdc5a0e0434a69c5e4078453c1e4ad 100644 (file)
@@ -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);
 
index e6cb294083649208a3f19388dc6caeb6b2887a8c..190a09338e86bf06acf13c5a4c16ef9f1224ddc4 100644 (file)
@@ -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
index 573125e7c677bf72fa83e680180e0f57ab952e00..38b3291babf18f3963b0f169a0f712558011b4ee 100644 (file)
@@ -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
index 62842dc5d87362db8c45e3a935cb4567bc243b51..fe81e45f3f785d9285f032074160b68384a88d1b 100644 (file)
@@ -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
index a0ddf86df1df4d4b2eadeb1deeb0ae611098347d..1141a200cfed962537d5d2246c63adb3fc7436e7 100644 (file)
@@ -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
index aa2e7f5bae36be2d4c5b066c9e05d73ebc62af46..2127441f1548df698a98e921bcc41eb7bd0cc14c 100644 (file)
@@ -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
index 47d2569f6662a93fc62d9c93af8f4a8aef751315..cfed433d92f4bcf663d147b614c215a1696e3297 100644 (file)
@@ -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
index 7b2c88366d07a30ee936273668b95f9073f390cc..87b1615318a4ec84f6cbd3a1a94b0f87a64b3769 100644 (file)
@@ -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
index ccf6bdd50bbc38cc49a2efc457a46085f4df16d8..4cf5629a84ee710116b8b66857f854ef81b272a9 100644 (file)
@@ -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
index b3f5473d9485a4ca1dbef044c1e4075d44b24ca2..d334516d071900546e07a632ee83a81d2d664a97 100644 (file)
@@ -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
index 265f83d439198b9057ac1c132f73f7539923bb5a..53592cc1fb3750054c6ca8b0d5cc657d91d3f4c1 100644 (file)
@@ -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
index 1ebc0c746520e90e01ac7fc0c7d8a755516f4ee9..85fc8359bd612c971a0bfba8d370a39e7824d149 100644 (file)
@@ -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