What is the default HTTP user agent string for NSURLConnection and NSURLSession on macOS?

Viewed 1732

does NSURLSession send user-agent automatically has an answer that describes the NSURLSession default HTTP User-Agent string for iOS. I want to know the default format for macOS (preferably with supporting documentation), and the default format for NSURLConnection as well.

I'm seeing some very old User-Agent strings on my site, and I'm trying to verify potential sources.

1 Answers

It follows that same code path as the iOS one.

nsurl/887 CFNetwork/887 Darwin/17.0.0 (x86_64)

$(CFBundleName)/$(CFBundleVersion) CFNetwork/$(CFNetworkVersion) Darwin/$(DarwinVersion) ($(Architecture))

If the program doesn't have a CFBundleName, its executable name is used instead. For missing CFBundleVersion, (unknown version) is used. This typically occurs when a command line tool without a bundle calls CFNetwork.

I don't think there is any documentation for this, and the default User Agent should be treated as a debugging facility instead of a specified behavior.

Related