Navigation Menu

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
Closed

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

wesinator opened this issue May 29, 2019 · 2 comments

Comments

@wesinator
Copy link
Contributor

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
Copy link
Member

bagder 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
Copy link
Contributor Author

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
@bagder bagder closed this as completed in ca09d96 Jun 1, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Aug 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging a pull request may close this issue.

2 participants