Merge topic 'macos-curl-user-agent' into release-3.30

1a74f95656 file(DOWNLOAD): Fix User-Agent to use run-time curl version

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9726
This commit is contained in:
Brad King
2024-08-15 13:36:28 +00:00
committed by Kitware Robot

View File

@@ -2131,7 +2131,10 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
res = ::curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
check_curl_result(res, "DOWNLOAD cannot set http failure option: ");
res = ::curl_easy_setopt(curl, CURLOPT_USERAGENT, "curl/" LIBCURL_VERSION);
curl_version_info_data* cv = curl_version_info(CURLVERSION_FIRST);
res = ::curl_easy_setopt(
curl, CURLOPT_USERAGENT,
cmStrCat("curl/", cv ? cv->version : LIBCURL_VERSION).c_str());
check_curl_result(res, "DOWNLOAD cannot set user agent option: ");
res = ::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, cmWriteToFileCallback);