dump-header creates file even if no response is received #3964
I did this
$ curl -D test_header.txt thissitedoesntexist.com curl: (6) Could not resolve host: thissitedoesntexist.com
Created file test_header.txt
I expected the following
dump-header file is not created until valid response headers are received.
The text was updated successfully, but these errors were encountered:
This is true and has been so virtually forever. I'm not sure I think this is something we should change.
The upside is that you know for sure when no headers have been delivered by curl, especially if you re-run the command line as then it could otherwise have the previous file contents lying around.
The make-no-file-if-nothing-to-write concept was abandoned for cookies for pretty much this reason, which makes me now lean towards favoring empty-files-for-empty-responses. Like this. Especially since this behavior has been here for a long time so scripts and users have gotten used to and come to rely on this by now.
Reported-by: wesinator at github Fixes #3964