Setting the NSURLDownload user agent
Setting the NSURLDownload user agent
- Subject: Setting the NSURLDownload user agent
- From: Nick Beadman <email@hidden>
- Date: Fri, 17 Apr 2015 14:23:17 -0700
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)
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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden