From: Christian Hofstaedtler Date: Tue, 28 Jan 2014 20:27:51 +0000 (+0100) Subject: webserver: add DELETE /../zones/ X-Git-Tag: rec-3.6.0-rc1~213^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a462a01dc43c4411a41cd1e4c6f203b6911eb8d8;p=thirdparty%2Fpdns.git webserver: add DELETE /../zones/ --- diff --git a/pdns/ws.cc b/pdns/ws.cc index 3edd78c74a..4b54eaf423 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();