I have a WebKit application which uses -[WebView setCustomUserAgent:] to set the user agent for the browser portion. I register certain URL schemes and then use NSURLDownload to download files from the server. So far so good.
What I have found is that if you create an NSURLDownload with NSURLRequest then the user-agent for an http download is set to something like: MyApplicationName/CFBundleVersion CFNetwork/720.3.13 Darwin/14.3.0 (x86_64) Some googling around pointed me to < http://youku.io/questions/31571/changing-the-useragent-of-nsurlconnection> which shows how to set the user-agent for the NSURLDownload by using a NSMutableURLConnection: NSMutableURLRequest* downloadRequest = [[[NSMutableURLRequest alloc] initWithURL:url] autorelease]; [downloadRequest setCachePolicy:NSURLRequestReloadIgnoringCacheData]; [downloadRequest setTimeoutInterval:timeout]; [downloadRequest addValue:@"My Custom User Agent/1.0" forHTTPHeaderField:@ "User-Agent"]; NSURLDownload* download = [[[NSURLDownload alloc] initWithRequest:downloadRequest delegate:self] autorelease]; When setting the user-agent this way it contains exactly what you set and nothing else. I would like to continue to append the CFNetwork and Darwin version. Any one know how to do that? Nick
_______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/macnetworkprog/archive%40mail-archive.com This email sent to [email protected]
