summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2010-06-04 17:38:07 (GMT)
committerDavid Cole <david.cole@kitware.com>2010-06-04 17:38:07 (GMT)
commitef491f78218e255339278656bf6dc26073fef264 (patch)
tree43b0b9904f50ae0d35d9e28169017d4b228a7238 /Source/cmFileCommand.cxx
parent0efa5f3747d604b117119561949b3e70548ba478 (diff)
downloadCMake-ef491f78218e255339278656bf6dc26073fef264.zip
CMake-ef491f78218e255339278656bf6dc26073fef264.tar.gz
CMake-ef491f78218e255339278656bf6dc26073fef264.tar.bz2
Allow redirects: set CURLOPT_FOLLOWLOCATION to 1
Enable file(DOWNLOAD ...) to follow redirects. Thanks to Michael Wild for requesting the addition and providing the majority of the patch.
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 8260cc7..d06014c 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -2763,6 +2763,15 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
return false;
}
+ res = ::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
+ if (res != CURLE_OK)
+ {
+ std::string errstring = "FILE(DOWNLOAD ) error; cannot set follow-redirect option: ";
+ errstring += ::curl_easy_strerror(res);
+ this->SetError(errstring.c_str());
+ return false;
+ }
+
if(verboseLog.size())
{
res = ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);