diff --git a/modules/geoipbackend/geoipinterface-dat.cc b/modules/geoipbackend/geoipinterface-dat.cc index f694eca88398..db87a2057631 100644 --- a/modules/geoipbackend/geoipinterface-dat.cc +++ b/modules/geoipbackend/geoipinterface-dat.cc @@ -287,7 +287,7 @@ class GeoIPInterfaceDAT : public GeoIPInterface free(result); gl.netmask = tmp_gl.netmask; // reduce space to dash - ret = boost::replace_all_copy(ret, " ", "-"); + std::replace(ret.begin(), ret.end(), ' ', '-'); return true; } } @@ -306,7 +306,7 @@ class GeoIPInterfaceDAT : public GeoIPInterface free(result); gl.netmask = tmp_gl.netmask; // reduce space to dash - ret = boost::replace_all_copy(ret, " ", "-"); + std::replace(ret.begin(), ret.end(), ' ', '-'); return true; } } diff --git a/pdns/dnsdistdist/dnsdist-actions.cc b/pdns/dnsdistdist/dnsdist-actions.cc index ad19901f2a6c..a56079915f38 100644 --- a/pdns/dnsdistdist/dnsdist-actions.cc +++ b/pdns/dnsdistdist/dnsdist-actions.cc @@ -45,7 +45,7 @@ DNSAction::Action DNSAction::typeFromString(const std::string& str) }; auto lower = boost::to_lower_copy(str); - boost::replace_all(lower, "-", ""); + lower.erase(std::remove(lower.begin(), lower.end(), '-'), lower.end()); auto mappingIt = s_mappings.find(lower); if (mappingIt != s_mappings.end()) { return mappingIt->second; diff --git a/pdns/dnsdistdist/dnsdist-carbon.cc b/pdns/dnsdistdist/dnsdist-carbon.cc index 66ec734250e4..eee7a5df96e4 100644 --- a/pdns/dnsdistdist/dnsdist-carbon.cc +++ b/pdns/dnsdistdist/dnsdist-carbon.cc @@ -78,7 +78,7 @@ static bool doOneCarbonExport(const Carbon::Endpoint& endpoint) for (const auto& state : dnsdist::configuration::getCurrentRuntimeConfiguration().d_backends) { string serverName = state->getName().empty() ? state->d_config.remote.toStringWithPort() : state->getName(); - boost::replace_all(serverName, ".", "_"); + std::replace(serverName.begin(), serverName.end(), '.', '_'); string base = namespace_name; base += "."; base += hostname; @@ -123,7 +123,7 @@ static bool doOneCarbonExport(const Carbon::Endpoint& endpoint) } string frontName = front->local.toStringWithPort() + (front->udpFD >= 0 ? "_udp" : "_tcp"); - boost::replace_all(frontName, ".", "_"); + std::replace(frontName.begin(), frontName.end(), '.', '_'); auto dupPair = frontendDuplicates.insert({frontName, 1}); if (!dupPair.second) { frontName += "_" + std::to_string(dupPair.first->second); @@ -180,7 +180,7 @@ static bool doOneCarbonExport(const Carbon::Endpoint& endpoint) for (const auto& entry : dnsdist::configuration::getCurrentRuntimeConfiguration().d_pools) { string poolName = entry.first; - boost::replace_all(poolName, ".", "_"); + std::replace(poolName.begin(), poolName.end(), '.', '_'); if (poolName.empty()) { poolName = "_default_"; } @@ -228,10 +228,10 @@ static bool doOneCarbonExport(const Carbon::Endpoint& endpoint) const string base = "dnsdist." + hostname + ".main.doh."; for (const auto& doh : dnsdist::getDoHFrontends()) { string name = doh->d_tlsContext.d_addr.toStringWithPort(); - boost::replace_all(name, ".", "_"); - boost::replace_all(name, ":", "_"); - boost::replace_all(name, "[", "_"); - boost::replace_all(name, "]", "_"); + std::replace(name.begin(), name.end(), '.', '_'); + std::replace(name.begin(), name.end(), ':', '_'); + std::replace(name.begin(), name.end(), '[', '_'); + std::replace(name.begin(), name.end(), ']', '_'); auto dupPair = dohFrontendDuplicates.insert({name, 1}); if (!dupPair.second) { @@ -274,7 +274,7 @@ static bool doOneCarbonExport(const Carbon::Endpoint& endpoint) auto records = dnsdist::QueryCount::g_queryCountRecords.write_lock(); for (const auto& record : *records) { qname = record.first; - boost::replace_all(qname, ".", "_"); + std::replace(qname.begin(), qname.end(), '.', '_'); str << "dnsdist.querycount." << qname << ".queries " << record.second << " " << now << "\r\n"; } records->clear(); diff --git a/pdns/dnsdistdist/dnsdist-secpoll.cc b/pdns/dnsdistdist/dnsdist-secpoll.cc index 5f6bb5733355..647b09fb83ae 100644 --- a/pdns/dnsdistdist/dnsdist-secpoll.cc +++ b/pdns/dnsdistdist/dnsdist-secpoll.cc @@ -205,8 +205,8 @@ void doSecPoll(const std::string& suffix) queriedName += '.'; } - boost::replace_all(queriedName, "+", "_"); - boost::replace_all(queriedName, "~", "_"); + std::replace(queriedName.begin(), queriedName.end(), '+', '_'); + std::replace(queriedName.begin(), queriedName.end(), '~', '_'); try { std::string status = getSecPollStatus(queriedName); diff --git a/pdns/dnsdistdist/dnsdist-web.cc b/pdns/dnsdistdist/dnsdist-web.cc index 253c00d3bb2d..f4c9431b64b5 100644 --- a/pdns/dnsdistdist/dnsdist-web.cc +++ b/pdns/dnsdistdist/dnsdist-web.cc @@ -623,7 +623,7 @@ static void handlePrometheus(const YaHTTP::Request& req, YaHTTP::Response& resp) serverName = state->getName(); } - boost::replace_all(serverName, ".", "_"); + std::replace(serverName.begin(), serverName.end(), '.', '_'); const std::string label = boost::str(boost::format(R"({server="%1%",address="%2%"})") % serverName % state->d_config.remote.toStringWithPort()); diff --git a/pdns/dnsdistdist/doh.cc b/pdns/dnsdistdist/doh.cc index 739684477b82..eb95c1302ce5 100644 --- a/pdns/dnsdistdist/doh.cc +++ b/pdns/dnsdistdist/doh.cc @@ -1145,8 +1145,8 @@ static int doh_handler(h2o_handler_t *self, h2o_req_t *req) if (pos != string::npos) { // need to base64url decode this string sdns(path.substr(pos+5)); - boost::replace_all(sdns,"-", "+"); - boost::replace_all(sdns,"_", "/"); + std::replace(sdns.begin(), sdns.end(), '-', '+'); + std::replace(sdns.begin(), sdns.end(), '_', '/'); // re-add padding that may have been missing switch (sdns.size() % 4) { case 2: diff --git a/pdns/lua-record.cc b/pdns/lua-record.cc index 32b8bab5582c..13b97f46b146 100644 --- a/pdns/lua-record.cc +++ b/pdns/lua-record.cc @@ -930,7 +930,7 @@ static void setupLuaRecords(LuaContext& lua) // NOLINT(readability-function-cogn vector candidates; // Getting something like 192-0-2-1.192-0-2-2.198-51-100-1.example.org for(auto l : s_lua_record_ctx->qname.getRawLabels()) { - boost::replace_all(l, "-", "."); + std::replace(l.begin(), l.end(), '-', '.'); try { candidates.emplace_back(l); } catch (const PDNSException& e) { @@ -1071,7 +1071,7 @@ static void setupLuaRecords(LuaContext& lua) // NOLINT(readability-function-cogn } else if(parts.size()==1) { if (parts[0].find('-') != std::string::npos) { - boost::replace_all(parts[0],"-",":"); + std::replace(parts[0].begin(), parts[0].end(), '-', ':'); ComboAddress ca(parts[0]); return ca.toString(); } else { @@ -1130,7 +1130,7 @@ static void setupLuaRecords(LuaContext& lua) // NOLINT(readability-function-cogn } string dashed=ip6.toString(); - boost::replace_all(dashed, ":", "-"); + std::replace(dashed.begin(), dashed.end(), ':', '-'); for(int i=31; i>=0; --i) fmt % labels[i]; diff --git a/pdns/misc.cc b/pdns/misc.cc index 1cc6d5114b2c..8f0a7bd45333 100644 --- a/pdns/misc.cc +++ b/pdns/misc.cc @@ -568,7 +568,7 @@ std::string getCarbonHostName() throw std::runtime_error(stringerror()); } - boost::replace_all(*hostname, ".", "_"); + std::replace(hostname->begin(), hostname->end(), '.', '_'); return *hostname; } diff --git a/pdns/recursordist/secpoll-recursor.cc b/pdns/recursordist/secpoll-recursor.cc index b54ae7dc5c71..6c89a406a1da 100644 --- a/pdns/recursordist/secpoll-recursor.cc +++ b/pdns/recursordist/secpoll-recursor.cc @@ -49,8 +49,8 @@ void doSecPoll(time_t* last_secpoll, Logr::log_t log) qstring += '.'; } - boost::replace_all(qstring, "+", "_"); - boost::replace_all(qstring, "~", "_"); + std::replace(qstring.begin(), qstring.end(), '+', '_'); + std::replace(qstring.begin(), qstring.end(), '~', '_'); vState state = vState::Indeterminate; DNSName query(qstring); diff --git a/pdns/secpoll-auth.cc b/pdns/secpoll-auth.cc index 7cc132aada7a..139f28acfd2f 100644 --- a/pdns/secpoll-auth.cc +++ b/pdns/secpoll-auth.cc @@ -44,8 +44,8 @@ void doSecPoll(bool first) if(*query.rbegin()!='.') query+='.'; - boost::replace_all(query, "+", "_"); - boost::replace_all(query, "~", "_"); + std::replace(query.begin(), query.end(), '+', '_'); + std::replace(query.begin(), query.end(), '~', '_'); int security_status = std::stoi(S.getValueStr("security-status")); diff --git a/pdns/test-misc_hh.cc b/pdns/test-misc_hh.cc index bb903d623605..45e9e375f964 100644 --- a/pdns/test-misc_hh.cc +++ b/pdns/test-misc_hh.cc @@ -213,7 +213,7 @@ BOOST_AUTO_TEST_CASE(test_getCarbonHostName) BOOST_CHECK_EQUAL(gethostname(buffer, sizeof buffer), 0); std::string my_hostname(buffer); - boost::replace_all(my_hostname, ".", "_"); + std::replace(my_hostname.begin(), my_hostname.end(), '.', '_'); std::string hostname = getCarbonHostName(); // ensure it matches what we get