From: Jay Freeman (saurik) Date: Sat, 26 Feb 2011 16:03:17 +0000 (-0800) Subject: Hack NSURLConnection to turn on HTTP pipelining. X-Git-Tag: v1.1.0%b1~151 X-Git-Url: https://git.saurik.com/cydia.git/commitdiff_plain/30c5be06ce9550fc2e1ac1e6018bde19a729c77c?ds=sidebyside Hack NSURLConnection to turn on HTTP pipelining. --- diff --git a/MobileCydia.mm b/MobileCydia.mm index ad48ee54..0d6c6369 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -10023,6 +10023,22 @@ MSHook(void, UIApplication$_updateApplicationAccessibility, UIApplication *self, } } +Class $NSURLConnection; + +MSHook(id, NSURLConnection$init$, NSURLConnection *self, SEL _cmd, NSURLRequest *request, id delegate, BOOL usesCache, int64_t maxContentLength, BOOL startImmediately, NSDictionary *connectionProperties) { + NSMutableURLRequest *copy([request mutableCopy]); + + NSURL *url([copy URL]); + NSString *host([url host]); + + if ([copy respondsToSelector:@selector(setHTTPShouldUsePipelining:)]) + if ([CydiaHosts_ containsObject:host]) + [copy setHTTPShouldUsePipelining:YES]; + + if ((self = _NSURLConnection$init$(self, _cmd, copy, delegate, usesCache, maxContentLength, startImmediately, connectionProperties)) != nil) { + } return self; +} + int main(int argc, char *argv[]) { _pooled _trace(); @@ -10069,6 +10085,13 @@ int main(int argc, char *argv[]) { _pooled method_setImplementation(UIWebDocumentView$_setUIKitDelegate$, reinterpret_cast(&$UIWebDocumentView$_setUIKitDelegate$)); } + $NSURLConnection = objc_getClass("NSURLConnection"); + Method NSURLConnection$init$(class_getInstanceMethod($NSURLConnection, @selector(_initWithRequest:delegate:usesCache:maxContentLength:startImmediately:connectionProperties:))); + if (NSURLConnection$init$ != NULL) { + _NSURLConnection$init$ = reinterpret_cast(method_getImplementation(NSURLConnection$init$)); + method_setImplementation(NSURLConnection$init$, reinterpret_cast(&$NSURLConnection$init$)); + } + $UIHardware = objc_getClass("UIHardware"); Method UIHardware$_playSystemSound$(class_getClassMethod($UIHardware, @selector(_playSystemSound:))); if (UIHardware$_playSystemSound$ != NULL) {