aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_httpd_stats.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2022-05-21 13:29:01 +0100
committerGravatar Sadie Powell2022-05-21 13:29:01 +0100
commit388fe6452028f76a8720014d44b1306b81d88a64 (patch)
tree1890bd903c161e06eec54fe4ff367114bf194ff9 /src/modules/m_httpd_stats.cpp
parentAllow preconfiguring the owner uid/gid while also disabling ownership. (diff)
Fix httpd_stats swallowing requests that it doesn't handle.
e.g. /stats/wibble
Diffstat (limited to 'src/modules/m_httpd_stats.cpp')
-rw-r--r--src/modules/m_httpd_stats.cpp17
1 files changed, 3 insertions, 14 deletions
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 << "<inspircdstats>";
-
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 << "</inspircdstats>";
- }
- else
- {
- data.clear();
- data.str(std::string());
+ return MOD_RES_PASSTHRU;
}
+ data << "</inspircdstats>";
/* 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);