mirror of
https://github.com/curl/curl.git
synced 2025-02-23 15:10:03 +08:00
src/tool_operate: create output file on successful download
... of an empty file Bug: https://github.com/bagder/curl/issues/183
This commit is contained in:
parent
f251417d85
commit
261a0fedcf
@ -14,6 +14,7 @@ This release includes the following changes:
|
|||||||
o curl: add --false-start option
|
o curl: add --false-start option
|
||||||
o add CURLOPT_PATH_AS_IS
|
o add CURLOPT_PATH_AS_IS
|
||||||
o curl: add --path-as-is option
|
o curl: add --path-as-is option
|
||||||
|
o curl: create output file on successful download of an empty file [21]
|
||||||
|
|
||||||
This release includes the following bugfixes:
|
This release includes the following bugfixes:
|
||||||
|
|
||||||
@ -154,3 +155,4 @@ References to bug reports and discussions on issues:
|
|||||||
[18] = http://curl.haxx.se/bug/view.cgi?id=1486
|
[18] = http://curl.haxx.se/bug/view.cgi?id=1486
|
||||||
[19] = https://github.com/bagder/curl/issues/195
|
[19] = https://github.com/bagder/curl/issues/195
|
||||||
[20] = https://github.com/bagder/curl/issues/192
|
[20] = https://github.com/bagder/curl/issues/192
|
||||||
|
[21] = https://github.com/bagder/curl/issues/183
|
||||||
|
@ -29,5 +29,8 @@
|
|||||||
|
|
||||||
size_t tool_write_cb(void *buffer, size_t sz, size_t nmemb, void *userdata);
|
size_t tool_write_cb(void *buffer, size_t sz, size_t nmemb, void *userdata);
|
||||||
|
|
||||||
|
/* create a local file for writing, return TRUE on success */
|
||||||
|
bool tool_create_output_file(struct OutStruct *outs);
|
||||||
|
|
||||||
#endif /* HEADER_CURL_TOOL_CB_WRT_H */
|
#endif /* HEADER_CURL_TOOL_CB_WRT_H */
|
||||||
|
|
||||||
|
@ -1388,6 +1388,13 @@ static CURLcode operate_do(struct GlobalConfig *global,
|
|||||||
#endif
|
#endif
|
||||||
result = curl_easy_perform(curl);
|
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 &&
|
if(outs.is_cd_filename && outs.stream && !global->mute &&
|
||||||
outs.filename)
|
outs.filename)
|
||||||
printf("curl: Saved to filename '%s'\n", outs.filename);
|
printf("curl: Saved to filename '%s'\n", outs.filename);
|
||||||
|
Loading…
Reference in New Issue
Block a user