diff options
author | Sadie Powell <sadie@witchery.services> | 2020-12-04 14:16:26 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2020-12-04 14:18:01 +0000 |
commit | 151a902ced88b0c1f1791d975332bbe293259acb (patch) | |
tree | 7c66b8a35444206766c83546605310b616912dc7 /src/modules/m_httpd_stats.cpp | |
parent | 08572a9376e6f41109e233cb45d7e491ad1ebf07 (diff) |
Normalise paths in the httpd module.
Diffstat (limited to 'src/modules/m_httpd_stats.cpp')
-rw-r--r-- | src/modules/m_httpd_stats.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 0b674cf64..f24fd9aec 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -423,32 +423,27 @@ class ModuleHttpStats : public Module, public HTTPRequestEventListener ModResult HandleRequest(HTTPRequest* http) { - std::string path = http->GetPath(); - - if (path != "/stats" && path.substr(0, 7) != "/stats/") + if (http->GetPath() != "/stats") return MOD_RES_PASSTHRU; - if (path[path.size() - 1] == '/') - path.erase(path.size() - 1, 1); - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Handling HTTP request for %s", http->GetPath().c_str()); bool found = true; std::stringstream data; data << "<inspircdstats>"; - if (path == "/stats") + if (http->GetPath() == "/stats") { data << Stats::ServerInfo << Stats::General << Stats::XLines << Stats::Modules << Stats::Channels << Stats::Users << Stats::Servers << Stats::Commands; } - else if (path == "/stats/general") + else if (http->GetPath() == "/stats/general") { data << Stats::General; } - else if (path == "/stats/users") + else if (http->GetPath() == "/stats/users") { if (enableparams) Stats::ListUsers(data, http->GetParsedURI().query_params); |