From a67bf25059e755a5d111410713537885d8e15690 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Tue, 17 Jul 2012 19:47:33 +0200 Subject: tss: Use https to contact webservices first as we sometimes hit a 404 over http After a while, Apple's servers have been begun redirecting to a 404 page using a 302 security redirect HTTP status code. By using a secure HTTPS connection retrieving TSS requests started to work fine again. --- src/tss.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tss.c b/src/tss.c index e505e6e..2c51e30 100644 --- a/src/tss.c +++ b/src/tss.c @@ -323,7 +323,10 @@ plist_t tss_send_request(plist_t tss_request) { unsigned int size = 0; char curl_error_message[CURL_ERROR_SIZE]; - const char* urls[3] = { + const char* urls[6] = { + "https://gs.apple.com/TSS/controller?action=2", + "https://17.171.36.30/TSS/controller?action=2", + "https://17.151.36.30/TSS/controller?action=2", "http://gs.apple.com/TSS/controller?action=2", "http://17.171.36.30/TSS/controller?action=2", "http://17.151.36.30/TSS/controller?action=2" @@ -355,6 +358,7 @@ plist_t tss_send_request(plist_t tss_request) { response->content = malloc(1); response->content[0] = '\0'; + curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0); curl_easy_setopt(handle, CURLOPT_ERRORBUFFER, &curl_error_message); curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, (curl_write_callback)&tss_write_callback); curl_easy_setopt(handle, CURLOPT_WRITEDATA, response); @@ -365,7 +369,7 @@ plist_t tss_send_request(plist_t tss_request) { if (use_apple_server==0) { curl_easy_setopt(handle, CURLOPT_URL, "http://cydia.saurik.com/TSS/controller?action=2"); } else { - int url_index = (retry - 1) % 3; + int url_index = (retry - 1) % 6; curl_easy_setopt(handle, CURLOPT_URL, urls[url_index]); info("Request URL set to %s\n", urls[url_index]); } -- cgit v1.1-32-gdbae