|
|
@@ -8,6 +8,7 @@
|
|
|
#include <sstream>
|
|
|
|
|
|
#include <cm/iomanip>
|
|
|
+#include <cm/optional>
|
|
|
#include <cmext/algorithm>
|
|
|
|
|
|
#include <cm3p/curl/curl.h>
|
|
|
@@ -22,7 +23,6 @@
|
|
|
#include "cmCurl.h"
|
|
|
#include "cmDuration.h"
|
|
|
#include "cmGeneratedFileStream.h"
|
|
|
-#include "cmList.h"
|
|
|
#include "cmState.h"
|
|
|
#include "cmStringAlgorithms.h"
|
|
|
#include "cmSystemTools.h"
|
|
|
@@ -172,30 +172,32 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
|
|
|
|
|
|
/* In windows, this will init the winsock stuff */
|
|
|
::curl_global_init(CURL_GLOBAL_ALL);
|
|
|
- std::string curlopt(this->CTest->GetCTestConfiguration("CurlOptions"));
|
|
|
- cmList args{ curlopt };
|
|
|
- bool verifyPeerOff = false;
|
|
|
- bool verifyHostOff = false;
|
|
|
- for (std::string const& arg : args) {
|
|
|
- if (arg == "CURLOPT_SSL_VERIFYPEER_OFF") {
|
|
|
- verifyPeerOff = true;
|
|
|
- }
|
|
|
- if (arg == "CURLOPT_SSL_VERIFYHOST_OFF") {
|
|
|
- verifyHostOff = true;
|
|
|
- }
|
|
|
- }
|
|
|
+ cmCTestCurlOpts curlOpts(this->CTest);
|
|
|
for (std::string const& file : files) {
|
|
|
/* get a curl handle */
|
|
|
curl = curl_easy_init();
|
|
|
if (curl) {
|
|
|
cmCurlSetCAInfo(curl);
|
|
|
- if (verifyPeerOff) {
|
|
|
+ if (curlOpts.TLSVersionOpt) {
|
|
|
+ cm::optional<std::string> tlsVersionStr =
|
|
|
+ cmCurlPrintTLSVersion(*curlOpts.TLSVersionOpt);
|
|
|
+ cmCTestOptionalLog(
|
|
|
+ this->CTest, HANDLER_VERBOSE_OUTPUT,
|
|
|
+ " Set CURLOPT_SSLVERSION to "
|
|
|
+ << (tlsVersionStr ? *tlsVersionStr : "unknown value") << "\n",
|
|
|
+ this->Quiet);
|
|
|
+ curl_easy_setopt(curl, CURLOPT_SSLVERSION, *curlOpts.TLSVersionOpt);
|
|
|
+ }
|
|
|
+ if (curlOpts.TLSVerifyOpt) {
|
|
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
|
|
- " Set CURLOPT_SSL_VERIFYPEER to off\n",
|
|
|
+ " Set CURLOPT_SSL_VERIFYPEER to "
|
|
|
+ << (*curlOpts.TLSVerifyOpt ? "on" : "off")
|
|
|
+ << "\n",
|
|
|
this->Quiet);
|
|
|
- curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
|
|
|
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER,
|
|
|
+ *curlOpts.TLSVerifyOpt ? 1 : 0);
|
|
|
}
|
|
|
- if (verifyHostOff) {
|
|
|
+ if (curlOpts.VerifyHostOff) {
|
|
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
|
|
" Set CURLOPT_SSL_VERIFYHOST to off\n",
|
|
|
this->Quiet);
|
|
|
@@ -518,9 +520,6 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
|
|
|
}
|
|
|
cmCTestCurl curl(this->CTest);
|
|
|
curl.SetQuiet(this->Quiet);
|
|
|
- std::string curlopt(this->CTest->GetCTestConfiguration("CurlOptions"));
|
|
|
- cmList args{ curlopt };
|
|
|
- curl.SetCurlOptions(args);
|
|
|
auto submitInactivityTimeout = this->GetSubmitInactivityTimeout();
|
|
|
if (submitInactivityTimeout != 0) {
|
|
|
curl.SetTimeOutSeconds(submitInactivityTimeout);
|