Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dump-header creates file even if no response is received #3964

Closed
wesinator opened this issue May 29, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@wesinator
Copy link
Contributor

commented May 29, 2019

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.

curl/libcurl version

curl 7.65.0 (x86_64-apple-darwin18.6.0) libcurl/7.65.0 SecureTransport zlib/1.2.11
Release-Date: 2019-05-22
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IPv6 Largefile libz NTLM NTLM_WB SSL UnixSockets

operating system

macOS 10.14

@bagder bagder added the cmdline tool label May 29, 2019

@bagder

This comment has been minimized.

Copy link
Member

commented May 29, 2019

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.

@wesinator

This comment has been minimized.

Copy link
Contributor Author

commented May 29, 2019

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.

Fair.
My only issue is that when running on multiple sites it creates a discrepancy between the number of files created to number of active sites.

bagder added a commit that referenced this issue May 31, 2019

dump-header.d: spell out that no headers == empty file [ci skip]
Reported-by: wesinator at github
Fixes #3964

@bagder bagder closed this in ca09d96 Jun 1, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.