]> git.saurik.com Git - cydia.git/commitdiff
Hack NSURLConnection to turn on HTTP pipelining.
authorJay Freeman (saurik) <saurik@saurik.com>
Sat, 26 Feb 2011 16:03:17 +0000 (08:03 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 7 Mar 2011 10:41:23 +0000 (02:41 -0800)
MobileCydia.mm

index ad48ee54f5e82b8d04b8fea3d3417aa50a4afc4f..0d6c6369cbb84ca2233a39250c2fe21cdfbafd36 100644 (file)
@@ -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();
 
 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<IMP>(&$UIWebDocumentView$_setUIKitDelegate$));
     }
 
         method_setImplementation(UIWebDocumentView$_setUIKitDelegate$, reinterpret_cast<IMP>(&$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<id (*)(NSURLConnection *, SEL, NSURLRequest *, id, BOOL, int64_t, BOOL, NSDictionary *)>(method_getImplementation(NSURLConnection$init$));
+        method_setImplementation(NSURLConnection$init$, reinterpret_cast<IMP>(&$NSURLConnection$init$));
+    }
+
     $UIHardware = objc_getClass("UIHardware");
     Method UIHardware$_playSystemSound$(class_getClassMethod($UIHardware, @selector(_playSystemSound:)));
     if (UIHardware$_playSystemSound$ != NULL) {
     $UIHardware = objc_getClass("UIHardware");
     Method UIHardware$_playSystemSound$(class_getClassMethod($UIHardware, @selector(_playSystemSound:)));
     if (UIHardware$_playSystemSound$ != NULL) {