this->d_post_json = true;
}
}
+ if (options.find("capath") != options.end()) this->d_capath = options.find("capath")->second;
+ if (options.find("cafile") != options.end()) this->d_cafile = options.find("cafile")->second;
}
HTTPConnector::~HTTPConnector() {
bool HTTPConnector::json2string(const rapidjson::Value &input, std::string &output) {
if (input.IsString()) output = input.GetString();
else if (input.IsNull()) output = "";
+ else if (input.IsUint64()) output = lexical_cast<std::string>(input.GetUint64());
+ else if (input.IsInt64()) output = lexical_cast<std::string>(input.GetInt64());
else if (input.IsUint()) output = lexical_cast<std::string>(input.GetUint());
else if (input.IsInt()) output = lexical_cast<std::string>(input.GetInt());
else return false;
curl_easy_setopt(d_c, CURLOPT_COPYPOSTFIELDS, out.c_str());
} else if (method == "feedRecord") {
std::string out = buildMemberListArgs("rr", ¶meters["rr"], d_c);
+ addUrlComponent(parameters, "trxid", ss);
curl_easy_setopt(d_c, CURLOPT_POSTFIELDSIZE, out.size());
curl_easy_setopt(d_c, CURLOPT_COPYPOSTFIELDS, out.c_str());
} else if (method == "feedEnts") {
std::stringstream ss2;
+ addUrlComponent(parameters, "trxid", ss);
for(rapidjson::Value::ConstValueIterator itr = parameters["nonterm"].Begin(); itr != parameters["nonterm"].End(); itr++) {
tmpstr = curl_easy_escape(d_c, itr->GetString(), 0);
ss2 << "nonterm[]=" << tmpstr << "&";
} else if (method == "feedEnts3") {
std::stringstream ss2;
addUrlComponent(parameters, "domain", ss);
+ addUrlComponent(parameters, "trxid", ss);
ss2 << "times=" << parameters["times"].GetInt() << "&salt=" << parameters["salt"].GetString() << "&narrow=" << (parameters["narrow"].GetBool() ? 1 : 0) << "&";
for(rapidjson::Value::ConstValueIterator itr = parameters["nonterm"].Begin(); itr != parameters["nonterm"].End(); itr++) {
tmpstr = curl_easy_escape(d_c, itr->GetString(), 0);
d_data = "";
curl_easy_setopt(d_c, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt(d_c, CURLOPT_TIMEOUT, this->timeout);
+
+ // turn off peer verification or set verification roots
+ if (d_capath.empty()) {
+ if (d_cafile.empty()) {
+ curl_easy_setopt(d_c, CURLOPT_SSL_VERIFYPEER, 0);
+ } else {
+ curl_easy_setopt(d_c, CURLOPT_CAINFO, d_cafile.c_str());
+ }
+ } else {
+ curl_easy_setopt(d_c, CURLOPT_CAPATH, d_capath.c_str());
+ }
slist = NULL;