From a462a01dc43c4411a41cd1e4c6f203b6911eb8d8 Mon Sep 17 00:00:00 2001 From: Christian Hofstaedtler Date: Tue, 28 Jan 2014 21:27:51 +0100 Subject: [PATCH] webserver: add DELETE /../zones/ --- pdns/ws.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pdns/ws.cc b/pdns/ws.cc index 3edd78c74..4b54eaf42 100644 --- a/pdns/ws.cc +++ b/pdns/ws.cc @@ -580,6 +580,20 @@ static void apiServerZoneDetail(HttpRequest* req, HttpResponse* resp) { resp->body = getZone(zonename); return; } + else if(req->method == "DELETE") { + // delete domain + UeberBackend B; + DomainInfo di; + if(!B.getDomainInfo(zonename, di)) + throw ApiException("Could not find domain '"+zonename+"'"); + + if(!di.backend->deleteDomain(zonename)) + throw ApiException("Deleting domain '"+zonename+"' failed: backend delete failed/unsupported"); + + // empty body on success + resp->body = ""; + return; + } if(req->method != "GET") throw HttpMethodNotAllowedException(); -- 2.40.0