tool_operate: support --dump-header % to direct to stderr

Similar to how --trace and --trace-ascii already do it.

Added test 1489 to verify

Closes #13992
This commit is contained in:
Daniel Stenberg 2024-08-04 16:01:41 +02:00
parent e26eefd9ce
commit 9b1e4b4632
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
4 changed files with 78 additions and 4 deletions

View file

@ -1057,7 +1057,12 @@ static CURLcode single_transfer(struct GlobalConfig *global,
/* Single header file for all URLs */
if(config->headerfile) {
/* open file for output: */
if(strcmp(config->headerfile, "-")) {
if(!strcmp(config->headerfile, "%")) {
heads->stream = stderr;
/* use binary mode for protocol header output */
set_binmode(heads->stream);
}
else if(strcmp(config->headerfile, "-")) {
FILE *newfile;
/*