From e958bd6ced1279daa56e8cd55aa25f8344dde7bb Mon Sep 17 00:00:00 2001 From: Christian Hofstaedtler Date: Wed, 28 Aug 2013 16:12:29 +0200 Subject: [PATCH] json webserver: return masters as an Array --- pdns/ws.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pdns/ws.cc b/pdns/ws.cc index dc306b52b..49c95c4e9 100644 --- a/pdns/ws.cc +++ b/pdns/ws.cc @@ -513,10 +513,13 @@ string StatWebServer::jsonstat(const string& method, const string& post, const m jdi.SetObject(); jdi.AddMember("name", di.zone.c_str(), doc.GetAllocator()); jdi.AddMember("kind", di.getKindString(), doc.GetAllocator()); - string masters = boost::join(di.masters, " "); - Value jmasters; - jmasters.SetString(masters.c_str(), masters.size(), doc.GetAllocator()); - jdi.AddMember("masters", jmasters, doc.GetAllocator()); // ^^^ this makes an actual copy, otherwise the zerocopy behaviour bites us! + Value masters; + masters.SetArray(); + BOOST_FOREACH(const string& master, di.masters) { + Value value(master.c_str(), doc.GetAllocator()); + masters.PushBack(value, doc.GetAllocator()); + } + jdi.AddMember("masters", masters, doc.GetAllocator()); jdi.AddMember("serial", di.serial, doc.GetAllocator()); jdi.AddMember("notified_serial", di.notified_serial, doc.GetAllocator()); jdi.AddMember("last_check", (unsigned int) di.last_check, doc.GetAllocator()); -- 2.50.1