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.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());