X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_httpd_stats.cpp;h=1e9f4ef4b92f6d8a33809b5b70d4778b6cfed8e1;hb=b0f16081ccaef527ed4b5434a7264508cf455f39;hp=b40c44d120067fdf38cca0c41b42ecec80c1ad4d;hpb=4a6fedd9324d87349a806c9c1d0ae6e7d3c1fd38;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index b40c44d12..1e9f4ef4b 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -5,7 +5,7 @@ * Copyright (C) 2018 Matt Schatz * Copyright (C) 2016 Johanna A * Copyright (C) 2013-2016 Attila Molnar - * Copyright (C) 2013, 2017, 2019 Sadie Powell + * Copyright (C) 2013, 2017, 2019-2020 Sadie Powell * Copyright (C) 2012 Robby * Copyright (C) 2009 Uli Schlachter * Copyright (C) 2009 Daniel De Graaf @@ -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 httpd event"); + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Handling HTTP request for %s", http->GetPath().c_str()); bool found = true; std::stringstream data; data << ""; - 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);