mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-04 04:40:56 -06:00
cmCTest: Remove dead code
This commit is contained in:
committed by
Brad King
parent
a5eeb0310d
commit
5a72dbd40c
@@ -43,7 +43,6 @@
|
||||
#include "cmCTestTestHandler.h"
|
||||
#include "cmCTestUpdateHandler.h"
|
||||
#include "cmCTestUploadHandler.h"
|
||||
#include "cmCurl.h"
|
||||
#include "cmDynamicLoader.h"
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include "cmGlobalGenerator.h"
|
||||
@@ -302,88 +301,6 @@ std::string cmCTest::GetCostDataFile()
|
||||
return fname;
|
||||
}
|
||||
|
||||
#ifdef CMAKE_BUILD_WITH_CMAKE
|
||||
static size_t HTTPResponseCallback(void* ptr, size_t size, size_t nmemb,
|
||||
void* data)
|
||||
{
|
||||
int realsize = static_cast<int>(size * nmemb);
|
||||
|
||||
std::string* response = static_cast<std::string*>(data);
|
||||
const char* chPtr = static_cast<char*>(ptr);
|
||||
*response += chPtr;
|
||||
|
||||
return realsize;
|
||||
}
|
||||
|
||||
int cmCTest::HTTPRequest(std::string url, HTTPMethod method,
|
||||
std::string& response, std::string const& fields,
|
||||
std::string const& putFile, int timeout)
|
||||
{
|
||||
CURL* curl;
|
||||
FILE* file;
|
||||
::curl_global_init(CURL_GLOBAL_ALL);
|
||||
curl = ::curl_easy_init();
|
||||
cmCurlSetCAInfo(curl);
|
||||
|
||||
// set request options based on method
|
||||
switch (method) {
|
||||
case cmCTest::HTTP_POST:
|
||||
::curl_easy_setopt(curl, CURLOPT_POST, 1);
|
||||
::curl_easy_setopt(curl, CURLOPT_POSTFIELDS, fields.c_str());
|
||||
break;
|
||||
case cmCTest::HTTP_PUT:
|
||||
if (!cmSystemTools::FileExists(putFile)) {
|
||||
response = "Error: File ";
|
||||
response += putFile + " does not exist.\n";
|
||||
return -1;
|
||||
}
|
||||
::curl_easy_setopt(curl, CURLOPT_PUT, 1);
|
||||
file = cmsys::SystemTools::Fopen(putFile, "rb");
|
||||
::curl_easy_setopt(curl, CURLOPT_INFILE, file);
|
||||
// fall through to append GET fields
|
||||
CM_FALLTHROUGH;
|
||||
case cmCTest::HTTP_GET:
|
||||
if (!fields.empty()) {
|
||||
url += "?" + fields;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
::curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
|
||||
::curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout);
|
||||
::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
|
||||
|
||||
// set response options
|
||||
::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, HTTPResponseCallback);
|
||||
::curl_easy_setopt(curl, CURLOPT_FILE, &response);
|
||||
::curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
|
||||
|
||||
CURLcode res = ::curl_easy_perform(curl);
|
||||
|
||||
::curl_easy_cleanup(curl);
|
||||
::curl_global_cleanup();
|
||||
|
||||
return static_cast<int>(res);
|
||||
}
|
||||
#endif
|
||||
|
||||
std::string cmCTest::MakeURLSafe(const std::string& str)
|
||||
{
|
||||
std::ostringstream ost;
|
||||
char buffer[10];
|
||||
for (unsigned char ch : str) {
|
||||
if ((ch > 126 || ch < 32 || ch == '&' || ch == '%' || ch == '+' ||
|
||||
ch == '=' || ch == '@') &&
|
||||
ch != 9) {
|
||||
sprintf(buffer, "%02x;", static_cast<unsigned int>(ch));
|
||||
ost << buffer;
|
||||
} else {
|
||||
ost << ch;
|
||||
}
|
||||
}
|
||||
return ost.str();
|
||||
}
|
||||
|
||||
std::string cmCTest::DecodeURL(const std::string& in)
|
||||
{
|
||||
std::string out;
|
||||
|
||||
@@ -60,22 +60,6 @@ public:
|
||||
PartCount // Update names in constructor when adding a part
|
||||
};
|
||||
|
||||
#ifdef CMAKE_BUILD_WITH_CMAKE
|
||||
enum HTTPMethod
|
||||
{
|
||||
HTTP_GET,
|
||||
HTTP_POST,
|
||||
HTTP_PUT
|
||||
};
|
||||
|
||||
/**
|
||||
* Perform an HTTP request.
|
||||
*/
|
||||
static int HTTPRequest(std::string url, HTTPMethod method,
|
||||
std::string& response, std::string const& fields = "",
|
||||
std::string const& putFile = "", int timeout = 0);
|
||||
#endif
|
||||
|
||||
/** Get a testing part id from its string name. Returns PartCount
|
||||
if the string does not name a valid part. */
|
||||
Part GetPartFromName(const char* name);
|
||||
@@ -341,9 +325,6 @@ public:
|
||||
const std::string& cmake_var,
|
||||
bool suppress = false);
|
||||
|
||||
/** Make string safe to be sent as a URL */
|
||||
static std::string MakeURLSafe(const std::string&);
|
||||
|
||||
/** Decode a URL to the original string. */
|
||||
static std::string DecodeURL(const std::string&);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user