summaryrefslogtreecommitdiff
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-09-18 14:53:07 -0400
committerBrad King <brad.king@kitware.com>2012-09-18 14:53:07 -0400
commit14aff4daf45a3cf0af59de60a464af9abe6a013c (patch)
treee0d09670ba285ed58da73ef7235e2f27461598ea /Source/cmFileCommand.cxx
parent70169ec1bfa5adc4bc99c1777f44c6f8446bba04 (diff)
downloadcmake-14aff4daf45a3cf0af59de60a464af9abe6a013c.tar.gz
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: Fredrik Ehnbom <fehnbom@nvidia.com>
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index bb129804e1..4ac58a46c8 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -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,
cmWriteToFileCallback);
check_curl_result(res, "DOWNLOAD cannot set write function: ");