summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestSubmit.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2003-01-12 02:47:35 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2003-01-12 02:47:35 (GMT)
commit96e0393dd68f3a55b42ea890358ae549dec85377 (patch)
tree7d2c099d41abcc5948889150c447c53d92d5ac3a /Source/CTest/cmCTestSubmit.cxx
parentb7308e8f6d5df18b7dbc65b5d536ffad3e41e9c9 (diff)
downloadCMake-96e0393dd68f3a55b42ea890358ae549dec85377.zip
CMake-96e0393dd68f3a55b42ea890358ae549dec85377.tar.gz
CMake-96e0393dd68f3a55b42ea890358ae549dec85377.tar.bz2
Add triggering
Diffstat (limited to 'Source/CTest/cmCTestSubmit.cxx')
-rw-r--r--Source/CTest/cmCTestSubmit.cxx63
1 files changed, 63 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,