diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2011-03-25 22:42:57 -0700 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2011-03-25 22:42:57 -0700 |
commit | daa21f8e7c9b884e318fd635e4444514bb442120 (patch) | |
tree | c57ab79ddc4a95bfebf20743fb22a829432c468f /MobileCydia.mm | |
parent | 823e2d9720d8fa7b060821439481e19c644ece1a (diff) |
Add crazy redirection mechanism for gs.apple.com.
Diffstat (limited to 'MobileCydia.mm')
-rw-r--r-- | MobileCydia.mm | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm index 0a86a2b..3c4acda 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -4632,8 +4632,22 @@ static _H<NSMutableSet> Diversions_; NSMutableURLRequest *copy([request mutableCopy]); NSURL *url([copy URL]); + NSString *href([url absoluteString]); NSString *host([url host]); + if ([href hasPrefix:@"https://cydia.saurik.com/TSS/"]) { + if (NSString *agent = [copy valueForHTTPHeaderField:@"X-User-Agent"]) { + [copy setValue:agent forHTTPHeaderField:@"User-Agent"]; + [copy setValue:nil forHTTPHeaderField:@"X-User-Agent"]; + } + + [copy setValue:nil forHTTPHeaderField:@"Referer"]; + [copy setValue:nil forHTTPHeaderField:@"Origin"]; + + [copy setURL:[NSURL URLWithString:[@"http://gs.apple.com/TSS/" stringByAppendingString:[href substringFromIndex:29]]]]; + return copy; + } + if ([copy valueForHTTPHeaderField:@"X-Cydia-Cf"] == nil) [copy setValue:[NSString stringWithFormat:@"%.2f", kCFCoreFoundationVersionNumber] forHTTPHeaderField:@"X-Cydia-Cf"]; if (Machine_ != NULL && [copy valueForHTTPHeaderField:@"X-Machine"] == nil) |