I came across an email on this a few months ago and made note of the
solution (since my app has similar needs). You must reconstruct a
new NSMutableURLRequest in the
connection:willSendRequest:redirectResponse: method of the
NSURLConnection delegate...
-(NSURLRequest *)connection:(NSURLConnection *)connection
willSendRequest:(NSURLRequest *)request redirectResponse:
(NSURLResponse *)redirectResponse
{
NSMutableURLRequest *newRequest = [request mutableCopy];
// returned request has had the UA field stripped, must fix
NSString* userAgentString = @"Mozilla/5.0 (Macintosh; U; PPC Mac
OS X; en-us) AppleWebKit/125.2 (KHTML, like Gecko) Pandora/2.0";
[newRequest setValue:userAgentString forHTTPHeaderField:@"User-
Agent"];
[newRequest setTimeoutInterval:15.0];
[newRequest setCachePolicy:NSURLRequestReloadIgnoringCacheData];
return newRequest;
}
How do I force for the initially set user-agent value to be used
throughout all forwardings?
Thanks for any help.
Alex
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden