]> granicus.if.org Git - pdns/commitdiff
json webserver: return masters as an Array
authorChristian Hofstaedtler <christian@hofstaedtler.name>
Wed, 28 Aug 2013 14:12:29 +0000 (16:12 +0200)
committerChristian Hofstaedtler <christian@hofstaedtler.name>
Wed, 4 Sep 2013 08:55:29 +0000 (10:55 +0200)
pdns/ws.cc

index dc306b52b49b59022e3441cda85c4cd88048138c..49c95c4e9422f0d11cb29e64eb08e2ff97e22446 100644 (file)
@@ -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());