]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
ws-recursor.cc: Remove redundant checks for method
authorAki Tuomi <cmouse@cmouse.fi>
Wed, 23 Aug 2023 13:05:26 +0000 (16:05 +0300)
committerAki Tuomi <cmouse@cmouse.fi>
Fri, 15 Dec 2023 09:51:00 +0000 (11:51 +0200)
pdns/recursordist/ws-recursor.cc

index b1880b6754e0780ec76396919fdfc56dd14bd619..a1ada80c7a6cae583409893f6995f1a21d63ef5d 100644 (file)
@@ -431,10 +431,6 @@ static void apiServerZoneDetailGET(HttpRequest* req, HttpResponse* resp)
 
 static void apiServerSearchData(HttpRequest* req, HttpResponse* resp)
 {
-  if (req->method != "GET") {
-    throw HttpMethodNotAllowedException();
-  }
-
   string qVar = req->getvars["q"];
   if (qVar.empty()) {
     throw ApiException("Query q can't be blank");
@@ -476,10 +472,6 @@ static void apiServerSearchData(HttpRequest* req, HttpResponse* resp)
 
 static void apiServerCacheFlush(HttpRequest* req, HttpResponse* resp)
 {
-  if (req->method != "PUT") {
-    throw HttpMethodNotAllowedException();
-  }
-
   DNSName canon = apiNameToDNSName(req->getvars["domain"]);
   bool subtree = req->getvars.count("subtree") > 0 && req->getvars["subtree"] == "true";
   uint16_t qtype = 0xffff;
@@ -493,12 +485,8 @@ static void apiServerCacheFlush(HttpRequest* req, HttpResponse* resp)
     {"result", "Flushed cache."}});
 }
 
-static void apiServerRPZStats(HttpRequest* req, HttpResponse* resp)
+static void apiServerRPZStats(HttpRequest* /* req */, HttpResponse* resp)
 {
-  if (req->method != "GET") {
-    throw HttpMethodNotAllowedException();
-  }
-
   auto luaconf = g_luaconfs.getLocal();
   auto numZones = luaconf->dfe.size();
 
@@ -531,10 +519,6 @@ static void prometheusMetrics(HttpRequest* req, HttpResponse* resp)
 {
   static MetricDefinitionStorage s_metricDefinitions;
 
-  if (req->method != "GET") {
-    throw HttpMethodNotAllowedException();
-  }
-
   std::ostringstream output;
 
   // Argument controls disabling of any stats. So