From f974bee6235ea049667e9c8f8edc2c84cc5e0f91 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 14 Jan 2022 08:30:26 +0100 Subject: curl: remove "separators" (when using globbed URLs) 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 | 22 ---------------------- src/tool_operate.h | 4 +--- tests/data/test1235 | 4 ---- tests/data/test18 | 3 --- 4 files changed, 1 insertion(+), 32 deletions(-) diff --git a/src/tool_operate.c b/src/tool_operate.c index fe2c43b55..daeb02e6b 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -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 : ""); - if(separator) - per->separator = aprintf("%s%s", CURLseparator, per->this_url); - } if(httpgetfields) { char *urlbuffer; /* Find out whether the url contains a file name */ diff --git a/src/tool_operate.h b/src/tool_operate.h index 61994052f..15fad86d6 100644 --- a/src/tool_operate.h +++ b/src/tool_operate.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2022, Daniel Stenberg, , 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; }; diff --git a/tests/data/test1235 b/tests/data/test1235 index b04958eeb..24e7f7391 100644 --- a/tests/data/test1235 +++ b/tests/data/test1235 @@ -63,25 +63,21 @@ Accept: */* ---_curl_--%HOSTIP:%HTTPPORT/%TESTNUMBER0001 HTTP/1.1 200 OK Funny-head: yesyes Content-Length: 15 the number one ---_curl_--%HOSTIP:%HTTPPORT/%TESTNUMBER0002 HTTP/1.1 200 OK Funny-head: yesyes Content-Length: 16 two is nice too ---_curl_--%HOSTIP:%HTTPPORT/%TESTNUMBER0001 HTTP/1.1 200 OK Funny-head: yesyes Content-Length: 15 the number one ---_curl_--%HOSTIP:%HTTPPORT/%TESTNUMBER0002 HTTP/1.1 200 OK Funny-head: yesyes Content-Length: 16 diff --git a/tests/data/test18 b/tests/data/test18 index 11b953ea6..888745889 100644 --- a/tests/data/test18 +++ b/tests/data/test18 @@ -65,19 +65,16 @@ Accept: */* ---_curl_--%HOSTIP:%HTTPPORT/%TESTNUMBER HTTP/1.1 200 OK Funny-head: yesyes Content-Length: 4 moo ---_curl_--%HOSTIP:%HTTPPORT/%TESTNUMBER0002 HTTP/1.1 200 OK Funny-head: yesyes Content-Length: 4 foo ---_curl_--%HOSTIP:%HTTPPORT/%TESTNUMBER0003 HTTP/1.1 200 OK Funny-head: yesyes Content-Length: 4 -- cgit v1.2.1