]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl: Let -D merge headers in one file again
authorEmil Engler <me@emilengler.com>
Tue, 21 Jan 2020 08:23:21 +0000 (09:23 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 21 Jan 2020 08:23:30 +0000 (09:23 +0100)
Closes #4762
Fixes #4753

src/tool_operate.c
tests/data/test2006
tests/data/test2007
tests/data/test2008
tests/data/test2009
tests/data/test2010

index 66f2139c86a34447e98dedccc4c5689ead7cd49d..2e6563a2008ce166299934244fa2e7ed568d525f 100644 (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;
index 1f5971726923a4747bd529c886d8eaeb4c0e3528..0b84937ed1107de5ceb241675e850f30f944e959 100644 (file)
@@ -86,6 +86,10 @@ Accept: */*
 Some data delivered from an HTTP resource
 </file1>
 <file2 name="log/heads2006">
+Content-Length: 496\r
+Accept-ranges: bytes\r
+
+\r
 HTTP/1.1 200 OK
 Date: Thu, 21 Jun 2012 14:49:01 GMT
 Server: test-server/fake
index a8e5f1b45a1816094a467c5441c387a386f8dfbf..c8c023efb03999f0542db984c0fa52f850029e62 100644 (file)
@@ -90,6 +90,10 @@ Something delivered from an HTTP resource
 s/Last-Modified:.*//
 </stripfile2>
 <file2 name="log/heads2007">
+Content-Length: 496\r
+Accept-ranges: bytes\r
+
+\r
 HTTP/1.1 200 OK
 Date: Thu, 21 Jun 2012 14:50:02 GMT
 Server: test-server/fake
index 1a00332853c47180fe5fd9989e1f69ccb1216240..570cdba7d3175b863db9cd73c56875a940a363a8 100644 (file)
@@ -82,6 +82,10 @@ Some stuff delivered from an HTTP resource
 s/Last-Modified:.*//
 </stripfile2>
 <file2 name="log/heads2008">
+Content-Length: 496\r
+Accept-ranges: bytes\r
+
+\r
 HTTP/1.1 200 OK
 Date: Thu, 21 Jun 2012 15:23:48 GMT
 Server: test-server/fake
index 08308d03e213c6c4fdd935213e04c71e016941d1..10f95df4c761568b629a29cf4c02ddd9ac2f0ead 100644 (file)
@@ -83,6 +83,10 @@ Some contents delivered from an HTTP resource
 s/Last-Modified:.*//
 </stripfile2>
 <file2 name="log/heads2009">
+Content-Length: 496\r
+Accept-ranges: bytes\r
+
+\r
 HTTP/1.1 200 OK
 Date: Thu, 21 Jun 2012 16:27:17 GMT
 Server: test-server/fake
index 068c481b51a4596f54de10afa896a2a253ee2879..d43f4f1e1a86adc4c25f6bdfa4042b258bd8cd23 100644 (file)
@@ -82,6 +82,10 @@ Contents delivered from an HTTP resource
 s/Last-Modified:.*//
 </stripfile2>
 <file2 name="log/heads2010">
+Content-Length: 496\r
+Accept-ranges: bytes\r
+
+\r
 HTTP/1.1 200 OK
 Date: Thu, 21 Jun 2012 17:37:27 GMT
 Server: test-server/fake