this->d_socket = NULL;
if (options.find("timeout") != options.end()) {
- this->timeout = boost::lexical_cast<int>(options.find("timeout")->second)/1000;
+ this->timeout = std::stoi(options.find("timeout")->second)/1000;
}
if (options.find("post") != options.end()) {
std::string val = options.find("post")->second;
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 if (input.IsUint64()) output = std::to_string(input.GetUint64());
+ else if (input.IsInt64()) output = std::to_string(input.GetInt64());
+ else if (input.IsUint()) output = std::to_string(input.GetUint());
+ else if (input.IsInt()) output = std::to_string(input.GetInt());
else return false;
return true;
}
size_t index = 0;
for(rapidjson::Value::ConstValueIterator itr = parameters["nsset"].Begin(); itr != parameters["nsset"].End(); itr++) {
index++;
- ss2 << buildMemberListArgs("nsset[" + boost::lexical_cast<std::string>(index) + "]", itr) << "&";
+ ss2 << buildMemberListArgs("nsset[" + std::to_string(index) + "]", itr) << "&";
}
req.body = ss2.str().substr(0, ss2.str().size()-1);
req.headers["content-type"] = "application/x-www-form-urlencoded; charset=utf-8";
- req.headers["content-length"] = boost::lexical_cast<std::string>(req.body.size());
+ req.headers["content-length"] = std::to_string(req.body.size());
verb = "POST";
} else if (method == "createSlaveDomain") {
addUrlComponent(parameters, "ip", ss);
size_t index = 0;
for(rapidjson::Value::ConstValueIterator itr = parameters["rrset"].Begin(); itr != parameters["rrset"].End(); itr++) {
index++;
- ss2 << buildMemberListArgs("rrset[" + boost::lexical_cast<std::string>(index) + "]", itr);
+ ss2 << buildMemberListArgs("rrset[" + std::to_string(index) + "]", itr);
}
req.body = ss2.str();
req.headers["content-type"] = "application/x-www-form-urlencoded; charset=utf-8";
- req.headers["content-length"] = boost::lexical_cast<std::string>(req.body.size());
+ req.headers["content-length"] = std::to_string(req.body.size());
verb = "PATCH";
} else if (method == "feedRecord") {
addUrlComponent(parameters, "trxid", ss);
req.body = buildMemberListArgs("rr", ¶meters["rr"]);
req.headers["content-type"] = "application/x-www-form-urlencoded; charset=utf-8";
- req.headers["content-length"] = boost::lexical_cast<std::string>(req.body.size());
+ req.headers["content-length"] = std::to_string(req.body.size());
verb = "PATCH";
} else if (method == "feedEnts") {
std::stringstream ss2;
}
req.body = ss2.str().substr(0, ss2.str().size()-1);
req.headers["content-type"] = "application/x-www-form-urlencoded; charset=utf-8";
- req.headers["content-length"] = boost::lexical_cast<std::string>(req.body.size());
+ req.headers["content-length"] = std::to_string(req.body.size());
verb = "PATCH";
} else if (method == "feedEnts3") {
std::stringstream ss2;
}
req.body = ss2.str().substr(0, ss2.str().size()-1);
req.headers["content-type"] = "application/x-www-form-urlencoded; charset=utf-8";
- req.headers["content-length"] = boost::lexical_cast<std::string>(req.body.size());
+ req.headers["content-length"] = std::to_string(req.body.size());
verb = "PATCH";
} else if (method == "startTransaction") {
addUrlComponent(parameters, "domain", ss);
addUrlComponent(parameters, "domain", ss);
req.body = buildMemberListArgs("sd", ¶meters["sd"]);
req.headers["content-type"] = "application/x-www-form-urlencoded; charset=utf-8";
- req.headers["content-length"] = boost::lexical_cast<std::string>(req.body.size());
+ req.headers["content-length"] = std::to_string(req.body.size());
verb = "POST";
} else if (method == "setDomainMetadata") {
// copy all metadata values into post
}
req.body = ss2.str().substr(0, ss2.str().size()-1);
req.headers["content-type"] = "application/x-www-form-urlencoded; charset=utf-8";
- req.headers["content-length"] = boost::lexical_cast<std::string>(req.body.size());
+ req.headers["content-length"] = std::to_string(req.body.size());
verb = "PATCH";
} else if (method == "removeDomainKey") {
// this one is delete
} else if (method == "searchRecords" || method == "searchComments") {
json2string(parameters["pattern"],sparam);
req.GET()["pattern"] = sparam;
- req.GET()["maxResults"] = boost::lexical_cast<std::string>(parameters["maxResults"].GetInt());
+ req.GET()["maxResults"] = std::to_string(parameters["maxResults"].GetInt());
verb = "GET";
} else {
// perform normal get
// simple case, POST JSON into url. nothing fancy.
std::string out = makeStringFromDocument(input);
req.headers["Content-Type"] = "text/javascript; charset=utf-8";
- req.headers["Content-Length"] = boost::lexical_cast<std::string>(out.size());
+ req.headers["Content-Length"] = std::to_string(out.size());
req.headers["accept"] = "application/json";
req.body = out;
} else {
} else {
// connect using tcp
struct addrinfo *gAddr, *gAddrPtr, hints;
- std::string sPort = boost::lexical_cast<std::string>(req.url.port);
+ std::string sPort = std::to_string(req.url.port);
memset(&hints,0,sizeof hints);
hints.ai_family = AF_UNSPEC;
hints.ai_flags = AI_ADDRCONFIG;
std::string Connector::getString(rapidjson::Value &value) {
if (value.IsString()) return value.GetString();
if (value.IsBool()) return (value.GetBool() ? "true" : "false");
- if (value.IsInt64()) return boost::lexical_cast<std::string>(value.GetInt64());
- if (value.IsInt()) return boost::lexical_cast<std::string>(value.GetInt());
- if (value.IsDouble()) return boost::lexical_cast<std::string>(value.GetDouble());
+ if (value.IsInt64()) return std::to_string(value.GetInt64());
+ if (value.IsInt()) return std::to_string(value.GetInt());
+ if (value.IsDouble()) return std::to_string(value.GetDouble());
return "(unpresentable value)"; // cannot convert into presentation format
}
if (value.IsDouble()) return static_cast<int>(value.GetDouble());
if (value.IsString()) { // accepts 0, 1, false, true
std::string tmp = value.GetString();
- return boost::lexical_cast<int>(tmp);
+ return std::stoi(tmp);
}
throw PDNSException("Cannot convert rapidjson value into integer");
}
if (value.IsDouble()) return static_cast<unsigned int>(value.GetDouble());
if (value.IsString()) { // accepts 0, 1, false, true
std::string tmp = value.GetString();
- return boost::lexical_cast<unsigned int>(tmp);
+ return pdns_stou(tmp);
}
throw PDNSException("Cannot convert rapidjson value into integer");
}
if (value.IsDouble()) return static_cast<int64_t>(value.GetDouble());
if (value.IsString()) { // accepts 0, 1, false, true
std::string tmp = value.GetString();
- return boost::lexical_cast<int64_t>(tmp);
+ return std::stoll(tmp);
}
throw PDNSException("Cannot convert rapidjson value into integer");
}
if (value.IsNull()) return "";
if (value.IsString()) return value.GetString();
if (value.IsBool()) return (value.GetBool() ? "true" : "false");
- if (value.IsInt64()) return boost::lexical_cast<std::string>(value.GetInt64());
- if (value.IsInt()) return boost::lexical_cast<std::string>(value.GetInt());
- if (value.IsDouble()) return boost::lexical_cast<std::string>(value.GetDouble());
+ if (value.IsInt64()) return std::to_string(value.GetInt64());
+ if (value.IsInt()) return std::to_string(value.GetInt());
+ if (value.IsDouble()) return std::to_string(value.GetDouble());
throw PDNSException("Cannot convert rapidjson value into std::string");
}
if (value.IsInt()) return static_cast<double>(value.GetInt());
if (value.IsString()) { // accepts 0, 1, false, true
std::string tmp = value.GetString();
- return boost::lexical_cast<double>(tmp);
+ return std::stod(tmp);
}
throw PDNSException("Cannot convert rapidjson value into double");
}