summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestCurl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CTest/cmCTestCurl.cxx')
-rw-r--r--Source/CTest/cmCTestCurl.cxx38
1 files changed, 23 insertions, 15 deletions
diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx
index 9a90f54..ab1412d 100644
--- a/Source/CTest/cmCTestCurl.cxx
+++ b/Source/CTest/cmCTestCurl.cxx
@@ -19,6 +19,7 @@ cmCTestCurl::cmCTestCurl(cmCTest* ctest)
// default is to verify https
this->VerifyPeerOff = false;
this->VerifyHostOff = false;
+ this->Quiet = false;
this->TimeOutSeconds = 0;
this->Curl = curl_easy_init();
}
@@ -96,6 +97,13 @@ bool cmCTestCurl::InitCurl()
}
// enable HTTP ERROR parsing
curl_easy_setopt(this->Curl, CURLOPT_FAILONERROR, 1);
+
+ // if there is little to no activity for too long stop submitting
+ if (this->TimeOutSeconds) {
+ curl_easy_setopt(this->Curl, CURLOPT_LOW_SPEED_LIMIT, 1);
+ curl_easy_setopt(this->Curl, CURLOPT_LOW_SPEED_TIME, this->TimeOutSeconds);
+ }
+
return true;
}
@@ -110,12 +118,7 @@ bool cmCTestCurl::UploadFile(std::string const& local_file,
}
/* enable uploading */
curl_easy_setopt(this->Curl, CURLOPT_UPLOAD, 1);
- // if there is little to no activity for too long stop submitting
- if (this->TimeOutSeconds) {
- ::curl_easy_setopt(this->Curl, CURLOPT_LOW_SPEED_LIMIT, 1);
- ::curl_easy_setopt(this->Curl, CURLOPT_LOW_SPEED_TIME,
- this->TimeOutSeconds);
- }
+
/* HTTP PUT please */
::curl_easy_setopt(this->Curl, CURLOPT_PUT, 1);
::curl_easy_setopt(this->Curl, CURLOPT_VERBOSE, 1);
@@ -157,13 +160,14 @@ bool cmCTestCurl::UploadFile(std::string const& local_file,
if (!responseData.empty()) {
response = std::string(responseData.begin(), responseData.end());
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Curl response: ["
- << response << "]\n");
+ cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Curl response: [" << response << "]\n", this->Quiet);
}
std::string curlDebug;
if (!debugData.empty()) {
curlDebug = std::string(debugData.begin(), debugData.end());
- cmCTestLog(this->CTest, DEBUG, "Curl debug: [" << curlDebug << "]\n");
+ cmCTestOptionalLog(this->CTest, DEBUG,
+ "Curl debug: [" << curlDebug << "]\n", this->Quiet);
}
if (response.empty()) {
cmCTestLog(this->CTest, ERROR_MESSAGE, "No response from server.\n"
@@ -177,9 +181,10 @@ bool cmCTestCurl::HttpRequest(std::string const& url,
std::string const& fields, std::string& response)
{
response = "";
- cmCTestLog(this->CTest, DEBUG, "HttpRequest\n"
- << "url: " << url << "\n"
- << "fields " << fields << "\n");
+ cmCTestOptionalLog(this->CTest, DEBUG, "HttpRequest\n"
+ << "url: " << url << "\n"
+ << "fields " << fields << "\n",
+ this->Quiet);
if (!this->InitCurl()) {
cmCTestLog(this->CTest, ERROR_MESSAGE, "Initialization of curl failed");
return false;
@@ -202,13 +207,16 @@ bool cmCTestCurl::HttpRequest(std::string const& url,
if (!responseData.empty()) {
response = std::string(responseData.begin(), responseData.end());
- cmCTestLog(this->CTest, DEBUG, "Curl response: [" << response << "]\n");
+ cmCTestOptionalLog(this->CTest, DEBUG,
+ "Curl response: [" << response << "]\n", this->Quiet);
}
if (!debugData.empty()) {
std::string curlDebug = std::string(debugData.begin(), debugData.end());
- cmCTestLog(this->CTest, DEBUG, "Curl debug: [" << curlDebug << "]\n");
+ cmCTestOptionalLog(this->CTest, DEBUG,
+ "Curl debug: [" << curlDebug << "]\n", this->Quiet);
}
- cmCTestLog(this->CTest, DEBUG, "Curl res: " << res << "\n");
+ cmCTestOptionalLog(this->CTest, DEBUG, "Curl res: " << res << "\n",
+ this->Quiet);
return (res == 0);
}