curl: Let -D merge headers in one file again

Closes #4762
Fixes #4753
This commit is contained in:
Emil Engler 2020-01-21 09:23:21 +01:00 committed by Daniel Stenberg
parent 81e1b1ec23
commit 1774dbd74c
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
6 changed files with 22 additions and 1 deletions

View file

@ -871,7 +871,8 @@ static CURLcode single_transfer(struct GlobalConfig *global,
if(config->headerfile) {
/* open file for output: */
if(strcmp(config->headerfile, "-")) {
FILE *newfile = fopen(config->headerfile, "wb");
FILE *newfile;
newfile = fopen(config->headerfile, per->prev == NULL?"wb":"ab");
if(!newfile) {
warnf(config->global, "Failed to open %s\n", config->headerfile);
result = CURLE_WRITE_ERROR;