diff options
author | Martin Szulecki | 2012-07-17 16:21:18 +0200 |
---|---|---|
committer | Nikias Bassen | 2012-07-17 16:21:18 +0200 |
commit | 190a6b04c4f12ee20e7ae86cc3f280c63c2503f6 (patch) | |
tree | 51ada07ebf425d79b730e690763cd36902741a8f /src/download.c | |
parent | 603f4cfca644c3afc75a4615f4b837e0bc6f3abf (diff) | |
download | idevicerestore-190a6b04c4f12ee20e7ae86cc3f280c63c2503f6.tar.gz idevicerestore-190a6b04c4f12ee20e7ae86cc3f280c63c2503f6.tar.bz2 |
Limit when downloading should show progress and when not
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); |