From 261a0fedcf1545440190965311a1554d7695b6c0 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Mon, 30 Mar 2015 13:56:30 +0200 Subject: src/tool_operate: create output file on successful download ... of an empty file Bug: https://github.com/bagder/curl/issues/183 --- src/tool_operate.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/tool_operate.c') diff --git a/src/tool_operate.c b/src/tool_operate.c index 01a61f9a7..771e42da6 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -1388,6 +1388,13 @@ static CURLcode operate_do(struct GlobalConfig *global, #endif result = curl_easy_perform(curl); + if(!result && !outs.stream && !outs.bytes + /* we have received no data despite the transfer was successful + ==> force cration of an empty output file (if an output file + was specified) */ + && !tool_create_output_file(&outs)) + result = CURLE_WRITE_ERROR; + if(outs.is_cd_filename && outs.stream && !global->mute && outs.filename) printf("curl: Saved to filename '%s'\n", outs.filename); -- cgit v1.2.1