From 388fe6452028f76a8720014d44b1306b81d88a64 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 21 May 2022 13:29:01 +0100 Subject: Fix httpd_stats swallowing requests that it doesn't handle. e.g. /stats/wibble --- src/modules/m_httpd_stats.cpp | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'src/modules/m_httpd_stats.cpp') diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 3ee6c4ef7..1770bc25c 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -430,10 +430,8 @@ class ModuleHttpStats : public Module, public HTTPRequestEventListener ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Handling HTTP request for %s", http->GetPath().c_str()); - bool found = true; std::stringstream data; data << ""; - if (http->GetPath() == "/stats") { data << Stats::ServerInfo << Stats::General @@ -454,21 +452,12 @@ class ModuleHttpStats : public Module, public HTTPRequestEventListener } else { - found = false; - } - - if (found) - { - data << ""; - } - else - { - data.clear(); - data.str(std::string()); + return MOD_RES_PASSTHRU; } + data << ""; /* Send the document back to m_httpd */ - HTTPDocumentResponse response(this, *http, &data, found ? 200 : 404); + HTTPDocumentResponse response(this, *http, &data, 200); response.headers.SetHeader("X-Powered-By", MODNAME); response.headers.SetHeader("Content-Type", "text/xml"); API->SendResponse(response); -- cgit v1.3.1-10-gc9f91