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.
This commit is contained in:
David Cole 2010-06-04 13:38:07 -04:00
parent 0efa5f3747
commit ef491f7821
1 changed files with 9 additions and 0 deletions

View File

@ -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);