From: Emil Engler Date: Tue, 21 Jan 2020 08:23:21 +0000 (+0100) Subject: curl: Let -D merge headers in one file again X-Git-Tag: curl-7_69_0~189 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1774dbd74c77cd6c728588c8a717903dd16003f3;p=thirdparty%2Fcurl.git curl: Let -D merge headers in one file again Closes #4762 Fixes #4753 --- diff --git a/src/tool_operate.c b/src/tool_operate.c index 66f2139c86..2e6563a200 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -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; diff --git a/tests/data/test2006 b/tests/data/test2006 index 1f59717269..0b84937ed1 100644 --- a/tests/data/test2006 +++ b/tests/data/test2006 @@ -86,6 +86,10 @@ Accept: */* Some data delivered from an HTTP resource +Content-Length: 496 +Accept-ranges: bytes + + HTTP/1.1 200 OK Date: Thu, 21 Jun 2012 14:49:01 GMT Server: test-server/fake diff --git a/tests/data/test2007 b/tests/data/test2007 index a8e5f1b45a..c8c023efb0 100644 --- a/tests/data/test2007 +++ b/tests/data/test2007 @@ -90,6 +90,10 @@ Something delivered from an HTTP resource s/Last-Modified:.*// +Content-Length: 496 +Accept-ranges: bytes + + HTTP/1.1 200 OK Date: Thu, 21 Jun 2012 14:50:02 GMT Server: test-server/fake diff --git a/tests/data/test2008 b/tests/data/test2008 index 1a00332853..570cdba7d3 100644 --- a/tests/data/test2008 +++ b/tests/data/test2008 @@ -82,6 +82,10 @@ Some stuff delivered from an HTTP resource s/Last-Modified:.*// +Content-Length: 496 +Accept-ranges: bytes + + HTTP/1.1 200 OK Date: Thu, 21 Jun 2012 15:23:48 GMT Server: test-server/fake diff --git a/tests/data/test2009 b/tests/data/test2009 index 08308d03e2..10f95df4c7 100644 --- a/tests/data/test2009 +++ b/tests/data/test2009 @@ -83,6 +83,10 @@ Some contents delivered from an HTTP resource s/Last-Modified:.*// +Content-Length: 496 +Accept-ranges: bytes + + HTTP/1.1 200 OK Date: Thu, 21 Jun 2012 16:27:17 GMT Server: test-server/fake diff --git a/tests/data/test2010 b/tests/data/test2010 index 068c481b51..d43f4f1e1a 100644 --- a/tests/data/test2010 +++ b/tests/data/test2010 @@ -82,6 +82,10 @@ Contents delivered from an HTTP resource s/Last-Modified:.*// +Content-Length: 496 +Accept-ranges: bytes + + HTTP/1.1 200 OK Date: Thu, 21 Jun 2012 17:37:27 GMT Server: test-server/fake