summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestCurl.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2015-01-29 19:42:44 (GMT)
committerBrad King <brad.king@kitware.com>2015-01-30 15:36:38 (GMT)
commit18e3771ac7c74986a4f06221a72781ace54b1169 (patch)
treeee24181a4343ca8d63b0e34a0bc8b6e4034a0f26 /Source/CTest/cmCTestCurl.cxx
parenta47b904db242abb903a968bd6109bc8a07d3c39a (diff)
downloadCMake-18e3771ac7c74986a4f06221a72781ace54b1169.zip
CMake-18e3771ac7c74986a4f06221a72781ace54b1169.tar.gz
CMake-18e3771ac7c74986a4f06221a72781ace54b1169.tar.bz2
ctest_submit: Escape URL components in CDASH_UPLOAD mode
Call curl_easy_escape on arguments sent to CDash upload.
Diffstat (limited to 'Source/CTest/cmCTestCurl.cxx')
-rw-r--r--Source/CTest/cmCTestCurl.cxx19
1 files changed, 15 insertions, 4 deletions
diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx
index b0d26cc..b4c0137 100644
--- a/Source/CTest/cmCTestCurl.cxx
+++ b/Source/CTest/cmCTestCurl.cxx
@@ -25,6 +25,21 @@ cmCTestCurl::cmCTestCurl(cmCTest* ctest)
this->VerifyPeerOff = false;
this->VerifyHostOff = false;
this->TimeOutSeconds = 0;
+ this->Curl = curl_easy_init();
+}
+
+cmCTestCurl::~cmCTestCurl()
+{
+ ::curl_easy_cleanup(this->Curl);
+ ::curl_global_cleanup();
+}
+
+std::string cmCTestCurl::Escape(std::string const& source)
+{
+ char* data1 = curl_easy_escape(this->Curl, source.c_str(), 0);
+ std::string ret = data1;
+ curl_free(data1);
+ return ret;
}
namespace
@@ -73,7 +88,6 @@ void cmCTestCurl::SetCurlOptions(std::vector<std::string> const& args)
bool cmCTestCurl::InitCurl()
{
- this->Curl = curl_easy_init();
if(!this->Curl)
{
return false;
@@ -160,7 +174,6 @@ bool cmCTestCurl::UploadFile(std::string const& local_file,
// Now run off and do what you've been told!
::curl_easy_perform(this->Curl);
::fclose(ftpfile);
- ::curl_global_cleanup();
if ( responseData.size() > 0 )
{
@@ -213,8 +226,6 @@ bool cmCTestCurl::HttpRequest(std::string const& url,
CURLcode res = ::curl_easy_perform(this->Curl);
- ::curl_easy_cleanup(this->Curl);
- ::curl_global_cleanup();
if ( responseData.size() > 0 )
{
response = std::string(responseData.begin(), responseData.end());