summaryrefslogtreecommitdiffstats
path: root/src/download.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2019-02-02 00:23:55 +0100
committerGravatar Nikias Bassen2019-02-02 00:23:55 +0100
commit519af01f7dcb448b59ca13bdc1a1b060484f41ec (patch)
tree3fc370ff01e8daefaa222884848e3d93142cd3db /src/download.c
parent65572cab6baf92cbe4d43fcb0c7a44bc87d95b85 (diff)
downloadidevicerestore-519af01f7dcb448b59ca13bdc1a1b060484f41ec.tar.gz
idevicerestore-519af01f7dcb448b59ca13bdc1a1b060484f41ec.tar.bz2
Use ipsw.me API to allow selection and download of any signed firmware version when using --latest
Diffstat (limited to 'src/download.c')
-rw-r--r--src/download.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/download.c b/src/download.c
index bd8a40f..8bae52f 100644
--- a/src/download.c
+++ b/src/download.c
@@ -65,7 +65,11 @@ int download_to_buffer(const char* url, char** buf, uint32_t* length)
curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, (curl_write_callback)&download_write_buffer_callback);
curl_easy_setopt(handle, CURLOPT_WRITEDATA, &response);
- curl_easy_setopt(handle, CURLOPT_USERAGENT, USER_AGENT_STRING);
+ if (strncmp(url, "https://api.ipsw.me/", 20) == 0) {
+ curl_easy_setopt(handle, CURLOPT_USERAGENT, USER_AGENT_STRING " idevicerestore/" PACKAGE_VERSION);
+ } else {
+ curl_easy_setopt(handle, CURLOPT_USERAGENT, USER_AGENT_STRING);
+ }
curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(handle, CURLOPT_URL, url);