Merge topic 'file-download-http-error'

09817e9 Make file(DOWNLOAD) fail on http error
This commit is contained in:
David Cole 2011-09-20 14:42:26 -04:00 committed by CMake Topic Stage
commit 47dac7ec97
1 changed files with 4 additions and 0 deletions

View File

@ -2753,6 +2753,10 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
check_curl_result(res, "DOWNLOAD cannot set url: "); check_curl_result(res, "DOWNLOAD cannot set url: ");
// enable HTTP ERROR parsing
res = ::curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
check_curl_result(res, "DOWNLOAD cannot set http failure option: ");
res = ::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, res = ::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
cmWriteToFileCallback); cmWriteToFileCallback);
check_curl_result(res, "DOWNLOAD cannot set write function: "); check_curl_result(res, "DOWNLOAD cannot set write function: ");