From 14aff4daf45a3cf0af59de60a464af9abe6a013c Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 18 Sep 2012 14:53:07 -0400 Subject: 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 --- Source/cmFileCommand.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index bb12980..4ac58a4 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2857,6 +2857,9 @@ cmFileCommand::HandleDownloadCommand(std::vector 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: "); -- cgit v0.12