summaryrefslogtreecommitdiff
path: root/MobileCydia.mm
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2011-02-26 08:03:17 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2011-03-07 02:41:23 -0800
commit30c5be06ce9550fc2e1ac1e6018bde19a729c77c (patch)
tree904f3609a389765ad3a064e168e2ce04d12277c2 /MobileCydia.mm
parent8d497e2a4c6478859f08e5e0bb912256c0ca64b1 (diff)
Hack NSURLConnection to turn on HTTP pipelining.
Diffstat (limited to 'MobileCydia.mm')
-rw-r--r--MobileCydia.mm23
1 files changed, 23 insertions, 0 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index ad48ee5..0d6c636 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<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) {