From ef491f78218e255339278656bf6dc26073fef264 Mon Sep 17 00:00:00 2001 From: David Cole Date: Fri, 4 Jun 2010 13:38:07 -0400 Subject: 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. --- Source/cmFileCommand.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) 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 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); -- cgit v0.12