Commit 14aff4da authored by Brad King's avatar Brad King

file(DOWNLOAD): Add HTTP User-Agent string

Some servers require a User-Agent string.  The curl command-line tool
just sends "curl/$curlver", so do the same.
Suggested-by: default avatarFredrik Ehnbom <>
parent 70169ec1
......@@ -2857,6 +2857,9 @@ cmFileCommand::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);
check_curl_result(res, "DOWNLOAD cannot set user agent option: ");
res = ::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
check_curl_result(res, "DOWNLOAD cannot set write function: ");
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment