]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl: remove "separators" (when using globbed URLs)
authorDaniel Stenberg <daniel@haxx.se>
Fri, 14 Jan 2022 07:30:26 +0000 (08:30 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 15 Jan 2022 22:41:28 +0000 (23:41 +0100)
Unless muted (with -s) When doing globbing, curl would output mime-like
separators between the separate transfers. This is not documented
anywhere, surprises users and clobbers the output. Gone now.

Updated test 18 and 1235

Reported-by: jonny112 on github
Bug: https://github.com/curl/curl/discussions/8257
Closes #8278

src/tool_operate.c
src/tool_operate.h
tests/data/test1235
tests/data/test18

index fe2c43b55b45c45916e930ccb80e26afc709506c..daeb02e6b5ef552cb3bde52bb9938f62651882fa 100644 (file)
@@ -90,8 +90,6 @@
 CURLcode curl_easy_perform_ev(CURL *easy);
 #endif
 
-#define CURLseparator  "--_curl_--"
-
 #ifndef O_BINARY
 /* since O_BINARY as used in bitmasks, setting it to zero makes it usable in
    source code but yet it doesn't ruin anything */
@@ -265,11 +263,6 @@ static CURLcode pre_transfer(struct GlobalConfig *global,
   struct_stat fileinfo;
   CURLcode result = CURLE_OK;
 
-  if(per->separator_err)
-    fprintf(global->errors, "%s\n", per->separator_err);
-  if(per->separator)
-    printf("%s\n", per->separator);
-
   if(per->uploadfile && !stdin_upload(per->uploadfile)) {
     /* VMS Note:
      *
@@ -633,8 +626,6 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
   if(outs->alloc_filename)
     free(outs->filename);
   free(per->this_url);
-  free(per->separator_err);
-  free(per->separator);
   free(per->outfile);
   free(per->uploadfile);
 
@@ -780,7 +771,6 @@ static CURLcode single_transfer(struct GlobalConfig *global,
     }
 
     {
-      int separator;
       unsigned long urlnum;
 
       if(!state->up && !infiles)
@@ -820,10 +810,6 @@ static CURLcode single_transfer(struct GlobalConfig *global,
       else
         urlnum = state->urlnum;
 
-      /* if multiple files extracted to stdout, insert separators! */
-      separator = ((!state->outfiles ||
-                    !strcmp(state->outfiles, "-")) && urlnum > 1);
-
       if(state->up < state->infilenum) {
         struct per_transfer *per = NULL;
         struct OutStruct *outs;
@@ -1159,14 +1145,6 @@ static CURLcode single_transfer(struct GlobalConfig *global,
           global->isatty = orig_isatty;
         }
 
-        if(urlnum > 1 && !global->mute) {
-          per->separator_err =
-            aprintf("\n[%lu/%lu]: %s --> %s",
-                    state->li + 1, urlnum, per->this_url,
-                    per->outfile ? per->outfile : "<stdout>");
-          if(separator)
-            per->separator = aprintf("%s%s", CURLseparator, per->this_url);
-        }
         if(httpgetfields) {
           char *urlbuffer;
           /* Find out whether the url contains a file name */
index 61994052f64d723c1d4bc29dcc0e5054c7d6e8dd..15fad86d634a95bf0804d19f7e57b1f16b8736de 100644 (file)
@@ -7,7 +7,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -69,8 +69,6 @@ struct per_transfer {
   bool ultotal_added;
 
   /* NULL or malloced */
-  char *separator_err;
-  char *separator;
   char *uploadfile;
 };
 
index b04958eeb6b63b11b65d37747d025472a2b47953..24e7f7391956496a362416a354eb1c2a4173eec3 100644 (file)
@@ -63,25 +63,21 @@ Accept: */*
 \r
 </protocol>
 <stdout>
---_curl_--%HOSTIP:%HTTPPORT/%TESTNUMBER0001
 HTTP/1.1 200 OK\r
 Funny-head: yesyes\r
 Content-Length: 15\r
 \r
 the number one
---_curl_--%HOSTIP:%HTTPPORT/%TESTNUMBER0002
 HTTP/1.1 200 OK\r
 Funny-head: yesyes\r
 Content-Length: 16\r
 \r
 two is nice too
---_curl_--%HOSTIP:%HTTPPORT/%TESTNUMBER0001
 HTTP/1.1 200 OK\r
 Funny-head: yesyes\r
 Content-Length: 15\r
 \r
 the number one
---_curl_--%HOSTIP:%HTTPPORT/%TESTNUMBER0002
 HTTP/1.1 200 OK\r
 Funny-head: yesyes\r
 Content-Length: 16\r
index 11b953ea67b06ca685d820f2767569cf25d08bfc..888745889dd25081e4d92af63eb2fb6fd925d272 100644 (file)
@@ -65,19 +65,16 @@ Accept: */*
 \r
 </protocol>
 <stdout>
---_curl_--%HOSTIP:%HTTPPORT/%TESTNUMBER
 HTTP/1.1 200 OK\r
 Funny-head: yesyes\r
 Content-Length: 4\r
 \r
 moo
---_curl_--%HOSTIP:%HTTPPORT/%TESTNUMBER0002
 HTTP/1.1 200 OK\r
 Funny-head: yesyes\r
 Content-Length: 4\r
 \r
 foo
---_curl_--%HOSTIP:%HTTPPORT/%TESTNUMBER0003
 HTTP/1.1 200 OK\r
 Funny-head: yesyes\r
 Content-Length: 4\r