From: Remi Gacogne Date: Thu, 26 Jan 2023 14:42:30 +0000 (+0100) Subject: dnsdist: Better HTTP error code for an invalid name in the cache API X-Git-Tag: dnsdist-1.8.0-rc1~74^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cc27ca38043a6d84b16ff8a448388dcf62e698df;p=thirdparty%2Fpdns.git dnsdist: Better HTTP error code for an invalid name in the cache API --- diff --git a/pdns/dnsdist-web.cc b/pdns/dnsdist-web.cc index 4db57b034e..3cfd46789d 100644 --- a/pdns/dnsdist-web.cc +++ b/pdns/dnsdist-web.cc @@ -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" },