diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2003-01-12 02:47:35 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2003-01-12 02:47:35 (GMT) |
commit | 96e0393dd68f3a55b42ea890358ae549dec85377 (patch) | |
tree | 7d2c099d41abcc5948889150c447c53d92d5ac3a /Source/CTest | |
parent | b7308e8f6d5df18b7dbc65b5d536ffad3e41e9c9 (diff) | |
download | CMake-96e0393dd68f3a55b42ea890358ae549dec85377.zip CMake-96e0393dd68f3a55b42ea890358ae549dec85377.tar.gz CMake-96e0393dd68f3a55b42ea890358ae549dec85377.tar.bz2 |
Add triggering
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestSubmit.cxx | 63 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmit.h | 4 |
2 files changed, 67 insertions, 0 deletions
diff --git a/Source/CTest/cmCTestSubmit.cxx b/Source/CTest/cmCTestSubmit.cxx index 515b2f9..a6a94e5 100644 --- a/Source/CTest/cmCTestSubmit.cxx +++ b/Source/CTest/cmCTestSubmit.cxx @@ -84,6 +84,69 @@ bool cmCTestSubmit::SubmitUsingFTP(const std::string& localprefix, return true; } +bool cmCTestSubmit::TriggerUsingHTTP(const std::vector<std::string>& files, + const std::string& remoteprefix, + const std::string& url) +{ + CURL *curl; + CURLcode res = CURLcode(); + FILE* ftpfile; + + /* In windows, this will init the winsock stuff */ + ::curl_global_init(CURL_GLOBAL_ALL); + + /* get a curl handle */ + curl = curl_easy_init(); + if(curl) + { + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); + std::string::size_type cc, kk; + for ( cc = 0; cc < files.size(); cc ++ ) + { + std::string file = remoteprefix + files[cc]; + std::string ofile = ""; + for ( kk = 0; kk < file.size(); kk ++ ) + { + char c = file[kk]; + char hex[4] = { 0, 0, 0, 0 }; + hex[0] = c; + switch ( c ) + { + case '+': + case '?': + case '/': + case '\\': + case '&': + case ' ': + case '=': + case '%': + sprintf(hex, "%%%02X", (int)c); + ofile.append(hex); + break; + break; + default: + ofile.append(hex); + } + } + std::string turl = url + "?xmlfile=" + ofile; + std::cout << "Trigger url: " << turl.c_str() << std::endl; + curl_easy_setopt(curl, CURLOPT_URL, turl.c_str()); + res = curl_easy_perform(curl); + if ( res ) + { + std::cout << "Error when uploading" << std::endl; + ::curl_easy_cleanup(curl); + ::curl_global_cleanup(); + return false; + } + } + // always cleanup + ::curl_easy_cleanup(curl); + } + ::curl_global_cleanup(); + return true; +} + bool cmCTestSubmit::SubmitUsingSCP(const std::string& localprefix, const std::vector<std::string>& files, const std::string& remoteprefix, diff --git a/Source/CTest/cmCTestSubmit.h b/Source/CTest/cmCTestSubmit.h index b28e192..76fc403 100644 --- a/Source/CTest/cmCTestSubmit.h +++ b/Source/CTest/cmCTestSubmit.h @@ -42,6 +42,10 @@ public: const std::vector<std::string>& files, const std::string& remoteprefix, const std::string& url); + + bool TriggerUsingHTTP(const std::vector<std::string>& files, + const std::string& remoteprefix, + const std::string& url); }; #endif |