]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Better HTTP error code for an invalid name in the cache API
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 26 Jan 2023 14:42:30 +0000 (15:42 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 26 Jan 2023 14:42:30 +0000 (15:42 +0100)
pdns/dnsdist-web.cc

index 4db57b034e598ee9d85baa7370b7b30c93b90c1f..3cfd46789d52e2f1c75142e3f3c30e1a6eda9828 100644 (file)
@@ -350,11 +350,13 @@ static bool isMethodAllowed(const YaHTTP::Request& req)
       return true;
     }
   }
+#ifndef DISABLE_WEB_CACHE_MANAGEMENT
   if (req.method == "DELETE") {
     if (req.url.path == "/api/v1/cache") {
       return true;
     }
   }
+#endif /* DISABLE_WEB_CACHE_MANAGEMENT */
   return false;
 }
 
@@ -1501,7 +1503,7 @@ static void handleCacheManagement(const YaHTTP::Request& req, YaHTTP::Response&
     name = DNSName(expungeName->second);
   }
   catch (const std::exception& e) {
-    resp.status = 404;
+    resp.status = 400;
     Json::object obj{
       { "status", "error" },
       { "error", "unable to parse the requested name" },