瀏覽代碼

Merge topic 'macos-curl-user-agent'

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

Acked-by: Kitware Robot <[email protected]>
Acked-by: buildbot <[email protected]>
Merge-request: !9726
Brad King 1 年之前
父節點
當前提交
d060b05217
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      Source/cmFileCommand.cxx

+ 4 - 1
Source/cmFileCommand.cxx

@@ -2182,7 +2182,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);