Re: Setting the NSURLDownload user agent
Re: Setting the NSURLDownload user agent
- Subject: Re: Setting the NSURLDownload user agent
- From: "Quinn \"The Eskimo!\"" <email@hidden>
- Date: Tue, 21 Apr 2015 09:42:27 +0100
On 20 Apr 2015, at 19:37, Nick Beadman <email@hidden> wrote:
> Does any one have any idea how I would write code to get the CFNetwork and Darwin versions?
@import Foundation;
static NSString * CFNetworkVersion(void) {
return [NSBundle bundleWithIdentifier:@"com.apple.CFNetwork"].infoDictionary[@"CFBundleShortVersionString"];
}
#include <sys/utsname.h>
static NSString * DarwinVersion(void) {
struct utsname u;
(void) uname(&u);
return [NSString stringWithUTF8String:u.release];
}
However, I'm with Jens here: if you're going to set a customised user name, just use the OS name and version. The only reason to be sending this goo is if you're server varies its behaviour base on the user agent string, which is a bad idea in general and pretty rare for a download server (as opposed to a server that's vending web pages, where it happens all the time).
Share and Enjoy
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
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