summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/download.c7
-rw-r--r--src/download.h2
-rw-r--r--src/idevicerestore.c4
-rw-r--r--src/ipsw.c2
4 files changed, 9 insertions, 6 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);
diff --git a/src/download.h b/src/download.h
index a0d0f91..7e82b52 100644
--- a/src/download.h
+++ b/src/download.h
@@ -28,7 +28,7 @@ extern "C" {
#include <stdint.h>
int download_to_buffer(const char* url, char** buf, uint32_t* length);
-int download_to_file(const char* url, const char* filename);
+int download_to_file(const char* url, const char* filename, int enable_progress);
#ifdef __cplusplus
}
diff --git a/src/idevicerestore.c b/src/idevicerestore.c
index 72a9bd1..bbd7462 100644
--- a/src/idevicerestore.c
+++ b/src/idevicerestore.c
@@ -104,7 +104,7 @@ static int load_version_data(struct idevicerestore_client_t* client)
if ((stat(VERSION_XML, &fst) < 0) || ((time(NULL)-86400) > fst.st_mtime)) {
__mkdir("cache", 0755);
- if (download_to_file("http://ax.itunes.apple.com/check/version", VERSION_XML ".tmp") == 0) {
+ if (download_to_file("http://ax.itunes.apple.com/check/version", VERSION_XML ".tmp", 0) == 0) {
remove(VERSION_XML);
if (rename(VERSION_XML ".tmp", VERSION_XML) < 0) {
error("ERROR: Could not update '" VERSION_XML "'\n");
@@ -301,7 +301,7 @@ int main(int argc, char* argv[]) {
sprintf(wtfipsw, "cache/%s", fnpart);
if (stat(wtfipsw, &fst) != 0) {
__mkdir("cache", 0755);
- download_to_file(s_wtfurl, wtfipsw);
+ download_to_file(s_wtfurl, wtfipsw, 0);
}
char wtfname[256];
diff --git a/src/ipsw.c b/src/ipsw.c
index 19f73ab..82abbda 100644
--- a/src/ipsw.c
+++ b/src/ipsw.c
@@ -449,7 +449,7 @@ int ipsw_download_latest_fw(plist_t version_data, const char* product, const cha
} else {
remove(fwlfn);
info("Downloading latest firmware (%s)\n", fwurl);
- download_to_file(fwurl, fwlfn);
+ download_to_file(fwurl, fwlfn, 1);
if (memcmp(isha1, zsha1, 20) != 0) {
info("\nVerifying '%s'...\n", fwlfn);
FILE* f = fopen(fwlfn, "rb");