]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth api: also return old serial from PATCH 5696/head
authorKonrad Wojas <github@m.wojas.nl>
Fri, 15 Sep 2017 06:39:32 +0000 (14:39 +0800)
committerKonrad Wojas <github@m.wojas.nl>
Fri, 15 Sep 2017 06:39:32 +0000 (14:39 +0800)
This adds the old serial as X-PDNS-Old-Serial and renames the header of
the new one to match.

The old serial is useful to verify that no other PATCH happened in the
meantime.

docs/http-api/endpoint-zones.rst
pdns/ws-auth.cc

index 6c3627b534f3009b95aacad16c2cee0276b1d6ae..a0b6b819296fc40e6a429d50c26e9985bfae3868 100644 (file)
@@ -42,7 +42,7 @@ Zones endpoint
 
   Modifies present RRsets and comments. Returns ``204 No Content`` on success.
 
-  The new zone serial will be returned in an `X-PDNS-Zone-Serial` header (auth 4.1+).
+  The new and old zone serials will be returned in `X-PDNS-New-Serial` and `X-PDNS-Old-Serial` headers (auth 4.1+).
 
   :param server_id: The name of the server
   :param zone_id: The id number of the :json:object:`Zone`
index cfad4fc9c61894bd94a0d22c1c7f771a1990cec4..5e2576719ff85ffe0e5affca41ef841bd5fb3ac1 100644 (file)
@@ -1500,9 +1500,10 @@ static void patchZone(HttpRequest* req, HttpResponse* resp) {
         throw ApiException("Hosting backend does not support editing records.");
       }
 
-      // return new serial in a header
+      // return old and new serials in headers
+      resp->headers["X-PDNS-Old-Serial"] = std::to_string(sd.serial);
       fillSOAData(rr.content, sd);
-      resp->headers["X-PDNS-Zone-Serial"] = std::to_string(sd.serial);
+      resp->headers["X-PDNS-New-Serial"] = std::to_string(sd.serial);
     }
 
   } catch(...) {