diff options
Diffstat (limited to 'src/download.c')
-rw-r--r-- | src/download.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/download.c b/src/download.c index 603342a..849088e 100644 --- a/src/download.c +++ b/src/download.c @@ -101,7 +101,7 @@ int download_progress(void *clientp, double dltotal, double dlnow, double ultota return 0; } -int download_to_file(const char* url, const char* filename) +int download_to_file(const char* url, const char* filename, int enable_progress) { int res = 0; curl_global_init(CURL_GLOBAL_ALL); @@ -124,7 +124,10 @@ int download_to_file(const char* url, const char* filename) curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, (curl_write_callback)&fwrite); curl_easy_setopt(handle, CURLOPT_WRITEDATA, f); - curl_easy_setopt(handle, CURLOPT_PROGRESSFUNCTION, (curl_progress_callback)&download_progress); + + if (enable_progress > 0) + curl_easy_setopt(handle, CURLOPT_PROGRESSFUNCTION, (curl_progress_callback)&download_progress); + curl_easy_setopt(handle, CURLOPT_NOPROGRESS, 0); curl_easy_setopt(handle, CURLOPT_USERAGENT, "InetURL/1.0"); curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, 1); |