NSMutableURLRequest: Keeping the connection open
NSMutableURLRequest: Keeping the connection open
- Subject: NSMutableURLRequest: Keeping the connection open
- From: Thomas Engelmeier <email@hidden>
- Date: Wed, 30 Mar 2011 18:15:11 +0200
Hi,
I´m trying to prevent NSMutableURLRequest / NSURLConnection from closing an connection after roughly 2 secs.
When within these two secs another request happens, the SSL connection stays open for another 2 secs.
Is there a way to access the the underlying stream? Or pass through an keep alive parameter?
I'd try to avoid rewriting the networking code with custom CFStream based HTTP client implementation
The connection code is something like
NSMutableURLRequest* request =
[NSMutableURLRequest requestWithURL:fullURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:90.]
[request setHTTPMethod:aMethod];
NSData* data = [self requestBodyForObject:anObject];
[request setHTTPBody:data];
// code deleted
if( !connection ) {
connection = [[NSURLConnection alloc] initWithRequest:aRequest delegate:self startImmediately:NO];
[connection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
[connection start];
}
Things I tried:
- Playing a lot with an debug proxy (Charles), our code and SimpleURLConnections
- defer release of the NSURLConnection of the request until the next request gets created
- play with HTTP keep alive headers
- connect against different https:// websites
TIA,
Thomas _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden