[Cmake-commits] CMake branch, next, updated. v3.4.0-rc1-193-g2f9ff12
Brad King
brad.king at kitware.com
Thu Oct 8 10:59:24 EDT 2015
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 2f9ff1252a2308e034b2ab6add40bd569256a4e1 (commit)
via 1b700612691e300540dc2418e5a71329f2da40cf (commit)
from 6d0145dbeace6b7be1073796cf95154764378114 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2f9ff1252a2308e034b2ab6add40bd569256a4e1
commit 2f9ff1252a2308e034b2ab6add40bd569256a4e1
Merge: 6d0145d 1b70061
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Oct 8 10:59:23 2015 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Oct 8 10:59:23 2015 -0400
Merge topic 'ctest-submit-content-type' into next
1b700612 CTest: Set Content-Type header for http file upload (#15774)
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1b700612691e300540dc2418e5a71329f2da40cf
commit 1b700612691e300540dc2418e5a71329f2da40cf
Author: Derek Bruening <bruening at google.com>
AuthorDate: Wed Oct 7 17:51:26 2015 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Thu Oct 8 10:57:29 2015 -0400
CTest: Set Content-Type header for http file upload (#15774)
Sets the Content-Type header for http file uploads to avoid running afoul
of ModSecurity rules on the server.
diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx
index b4c0137..7401ff7 100644
--- a/Source/CTest/cmCTestCurl.cxx
+++ b/Source/CTest/cmCTestCurl.cxx
@@ -166,6 +166,9 @@ bool cmCTestCurl::UploadFile(std::string const& local_file,
curlWriteMemoryCallback);
::curl_easy_setopt(this->Curl, CURLOPT_DEBUGFUNCTION,
curlDebugCallback);
+ // Be sure to set Content-Type to satisfy fussy modsecurity rules
+ struct curl_slist *headers = ::curl_slist_append(NULL, "Content-Type: text/xml");
+ ::curl_easy_setopt(this->Curl, CURLOPT_HTTPHEADER, headers);
std::vector<char> responseData;
std::vector<char> debugData;
::curl_easy_setopt(this->Curl, CURLOPT_FILE, (void *)&responseData);
@@ -174,6 +177,8 @@ 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_easy_setopt(this->Curl, CURLOPT_HTTPHEADER, NULL);
+ ::curl_slist_free_all(headers);
if ( responseData.size() > 0 )
{
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 1e12f15..cb00dce 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -338,6 +338,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
CURLcode res;
FILE* ftpfile;
char error_buffer[1024];
+ struct curl_slist *headers = ::curl_slist_append(NULL, "Content-Type: text/xml");
/* In windows, this will init the winsock stuff */
::curl_global_init(CURL_GLOBAL_ALL);
@@ -420,6 +421,9 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
::curl_easy_setopt(curl, CURLOPT_PUT, 1);
::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
+ // Be sure to set Content-Type to satisfy fussy modsecurity rules
+ ::curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
+
std::string local_file = *file;
if ( !cmSystemTools::FileExists(local_file.c_str()) )
{
@@ -477,6 +481,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot find file: "
<< local_file << std::endl);
::curl_easy_cleanup(curl);
+ ::curl_slist_free_all(headers);
::curl_global_cleanup();
return false;
}
@@ -621,6 +626,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
<< std::endl);
}
::curl_easy_cleanup(curl);
+ ::curl_slist_free_all(headers);
::curl_global_cleanup();
return false;
}
@@ -630,6 +636,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
" Uploaded: " + local_file << std::endl, this->Quiet);
}
}
+ ::curl_slist_free_all(headers);
::curl_global_cleanup();
return true;
}
-----------------------------------------------------------------------
Summary of changes:
Source/CTest/cmCTestCurl.cxx | 5 +++++
Source/CTest/cmCTestSubmitHandler.cxx | 7 +++++++
2 files changed, 12 insertions(+)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list