|
|
|
@ -143,7 +143,6 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
|
|
|
|
|
const std::string& remoteprefix, const std::string& url)
|
|
|
|
|
{
|
|
|
|
|
CURL* curl;
|
|
|
|
|
CURLcode res;
|
|
|
|
|
FILE* ftpfile;
|
|
|
|
|
char error_buffer[1024];
|
|
|
|
|
// Set Content-Type to satisfy fussy modsecurity rules.
|
|
|
|
@ -211,8 +210,6 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
|
|
|
|
|
if (this->CTest->ShouldUseHTTP10()) {
|
|
|
|
|
curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
|
|
|
|
|
}
|
|
|
|
|
// enable HTTP ERROR parsing
|
|
|
|
|
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
|
|
|
|
|
/* enable uploading */
|
|
|
|
|
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
|
|
|
|
|
|
|
|
|
@ -286,7 +283,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
|
|
|
|
|
upload_as += "&MD5=";
|
|
|
|
|
|
|
|
|
|
if (cmIsOn(this->GetOption("InternalTest"))) {
|
|
|
|
|
upload_as += "bad_md5sum";
|
|
|
|
|
upload_as += "ffffffffffffffffffffffffffffffff";
|
|
|
|
|
} else {
|
|
|
|
|
upload_as +=
|
|
|
|
|
cmSystemTools::ComputeFileHash(local_file, cmCryptoHash::AlgoMD5);
|
|
|
|
@ -338,7 +335,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
|
|
|
|
|
::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &chunkDebug);
|
|
|
|
|
|
|
|
|
|
// Now run off and do what you've been told!
|
|
|
|
|
res = ::curl_easy_perform(curl);
|
|
|
|
|
::curl_easy_perform(curl);
|
|
|
|
|
|
|
|
|
|
if (!chunk.empty()) {
|
|
|
|
|
cmCTestOptionalLog(this->CTest, DEBUG,
|
|
|
|
@ -359,7 +356,11 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
|
|
|
|
|
|
|
|
|
|
// If curl failed for any reason, or checksum fails, wait and retry
|
|
|
|
|
//
|
|
|
|
|
if (res != CURLE_OK || this->HasErrors) {
|
|
|
|
|
long response_code;
|
|
|
|
|
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
|
|
|
|
|
bool successful_submission = response_code == 200;
|
|
|
|
|
|
|
|
|
|
if (!successful_submission || this->HasErrors) {
|
|
|
|
|
std::string retryDelay = *this->GetOption("RetryDelay");
|
|
|
|
|
std::string retryCount = *this->GetOption("RetryCount");
|
|
|
|
|
|
|
|
|
@ -397,7 +398,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
|
|
|
|
|
chunkDebug.clear();
|
|
|
|
|
this->HasErrors = false;
|
|
|
|
|
|
|
|
|
|
res = ::curl_easy_perform(curl);
|
|
|
|
|
::curl_easy_perform(curl);
|
|
|
|
|
|
|
|
|
|
if (!chunk.empty()) {
|
|
|
|
|
cmCTestOptionalLog(this->CTest, DEBUG,
|
|
|
|
@ -408,14 +409,16 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
|
|
|
|
|
this->ParseResponse(chunk);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (res == CURLE_OK && !this->HasErrors) {
|
|
|
|
|
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
|
|
|
|
|
if (response_code == 200 && !this->HasErrors) {
|
|
|
|
|
successful_submission = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fclose(ftpfile);
|
|
|
|
|
if (res) {
|
|
|
|
|
if (!successful_submission) {
|
|
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
|
|
|
|
" Error when uploading file: " << local_file
|
|
|
|
|
<< std::endl);
|
|
|
|
|