diff options
author | Rolf Eike Beer <eike@sf-mail.de> | 2020-03-21 11:53:26 (GMT) |
---|---|---|
committer | Rolf Eike Beer <eike@sf-mail.de> | 2020-03-23 21:41:44 (GMT) |
commit | 761f1adcae026c6fd9e10dafdde679adbfaf5869 (patch) | |
tree | 2c080c816620496566cd888f6dc3eb4fa5b06c3a | |
parent | ef778d77e0795ecba8af55a6984ad5fa5f44377a (diff) | |
download | CMake-761f1adcae026c6fd9e10dafdde679adbfaf5869.zip CMake-761f1adcae026c6fd9e10dafdde679adbfaf5869.tar.gz CMake-761f1adcae026c6fd9e10dafdde679adbfaf5869.tar.bz2 |
check for a valid URL scheme before starting to do any splitting
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.cxx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 22ab48f..d867fa1 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -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. |