NSURLConnection constantly redirecting
NSURLConnection constantly redirecting
- Subject: NSURLConnection constantly redirecting
- From: Jesus De Meyer <email@hidden>
- Date: Wed, 18 Apr 2007 21:19:57 +0200
Hi again,
For certain sites the delegate method for NSURLConnection constantly
receives redirection calls. It never stops even after data has been
received and the object has been released.
This is what I do when I get a redirect call:
- (NSURLRequest*)connection:(NSURLConnection*)aURLConnection
willSendRequest:(NSURLRequest *)request redirectResponse:
(NSURLResponse *)redirectResponse {
return request;
}
and the way the NSURLConnection is made:
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:
[self URL]
cachePolicy:NSURLRequestReloadIgnoringCacheData
timeoutInterval:60.0];
NSString *versionNumber = (NSString*)
CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(),
(CFStringRef)@"CFBundleVersion");
[request addValue:[NSString stringWithFormat:@"My App/%@",
[request setHTTPShouldHandleCookies:NO];
if (receivedData) { [receivedData release]; receivedData = nil; }
receivedData = [[NSMutableData data] retain];
if (connection) { [connection release]; connection = nil; }
connection = [[NSURLConnection connectionWithRequest:request
delegate:self] retain];
if (connection == nil) {
NSLog(@"error NSURLConnection");
}
Thanks in advance,
Jesus
__________________
Jesus De Meyer
www.edot-studios.com
jesus.edot-studios.com
"creativity in mind"
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden