curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

File overwritten with HTTP/1.1 304 Not Modified

From: Paul Gilmartin via curl-users <>
Date: Sat, 31 Aug 2019 11:52:57 -0600

Hello, Curlers,

On MacOS: 566 $ uname -a
Darwin 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 ...
With Curl: 567 $ curl -V
curl 7.54.0 (x86_64-apple-darwin18.0) libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1 ...

I try:
ifcurl 31+ curl --location --fail --show-error --header 'If-None-Match: "1541025663+ident"' --header 'Host:' --header 'From:' --dump-header --output

... and receive headers:
571 $ cat *headers
HTTP/1.1 304 Not Modified
Cache-Control: max-age=604800
Date: Sat, 31 Aug 2019 17:44:55 GMT
Etag: "1541025663+ident"
Expires: Sat, 07 Sep 2019 17:44:55 GMT
Last-Modified: Fri, 09 Aug 2013 23:54:35 GMT
Server: ECS (dna/63B4)
Vary: Accept-Encoding
X-Cache: HIT

*however* my --output file is overwritten with an empty file.
I'd prefer that this not happen.

Is there a combination of options that preserves the file in case of 304?
Should I consider this a bug?

I believe an earlier release of curl on Raspberry Pi did not overwrite.

I understand that in case of some errors, such as 404, the user prefers
to receive the file.


Received on 2019-08-31