1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-19 02:17:27 +08:00

check for a valid URL scheme before starting to do any splitting

This commit is contained in:
Rolf Eike Beer
2020-03-21 12:53:26 +01:00
parent ef778d77e0
commit 761f1adcae

View File

@@ -506,18 +506,19 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
curl.SetTimeOutSeconds(SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT);
curl.SetHttpHeaders(this->HttpHeaders);
std::string url = this->CTest->GetSubmitURL();
std::string fields;
std::string::size_type pos = url.find('?');
if (pos != std::string::npos) {
fields = url.substr(pos + 1);
url = url.substr(0, pos);
}
if (!cmHasLiteralPrefix(url, "http://") &&
!cmHasLiteralPrefix(url, "https://")) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Only http and https are supported for CDASH_UPLOAD\n");
return -1;
}
std::string fields;
std::string::size_type pos = url.find('?');
if (pos != std::string::npos) {
fields = url.substr(pos + 1);
url.erase(pos);
}
bool internalTest = cmIsOn(this->GetOption("InternalTest"));
// Get RETRY_COUNT and RETRY_DELAY values if they were set.