]> granicus.if.org Git - pdns/commitdiff
Properly prepare POST for transaction
authorAki Tuomi <cmouse@cmouse.fi>
Sat, 9 Jan 2016 13:53:45 +0000 (15:53 +0200)
committerAki Tuomi <cmouse@cmouse.fi>
Mon, 11 Jan 2016 18:44:20 +0000 (20:44 +0200)
modules/remotebackend/httpconnector.cc

index 5ac8309114deee89ccbf7179a3749d1df706f1a0..5ae2b2704bef79ccf7a898b883dbc426e978882b 100644 (file)
@@ -96,6 +96,7 @@ void HTTPConnector::restful_requestbuilder(const std::string &method, const Json
     // set the correct type of request based on method
     if (method == "activateDomainKey" || method == "deactivateDomainKey") {
         // create an empty post
+        req.preparePost();
         verb = "POST";
     } else if (method == "setTSIGKey") {
         req.POST()["algorithm"] = parameters["algorithm"].string_value();
@@ -180,9 +181,11 @@ void HTTPConnector::restful_requestbuilder(const std::string &method, const Json
     } else if (method == "startTransaction") {
         addUrlComponent(parameters, "domain", ss);
         addUrlComponent(parameters, "trxid", ss);
+        req.preparePost();
         verb = "POST";
     } else if (method == "commitTransaction" || method == "abortTransaction") {
         addUrlComponent(parameters, "trxid", ss);
+        req.preparePost();
         verb = "POST";
     } else if (method == "calculateSOASerial") {
         addUrlComponent(parameters, "domain", ss);
@@ -233,7 +236,7 @@ void HTTPConnector::restful_requestbuilder(const std::string &method, const Json
            member == "real-remote" ||
            member == "zone-id")) {
         std::string hdr = "x-remotebackend-" + member;
-        req.headers[hdr] = pair.second.string_value();
+        req.headers[hdr] = asString(pair.second);
       }
     };