]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_httpd_stats.cpp
Sync helpop chmodes s and p with docs
[user/henk/code/inspircd.git] / src / modules / m_httpd_stats.cpp
index 0b674cf6490217c4276d2c582c6affc8fc58cc1a..1e9f4ef4b92f6d8a33809b5b70d4778b6cfed8e1 100644 (file)
@@ -5,7 +5,7 @@
  *   Copyright (C) 2018 Matt Schatz <genius3000@g3k.solutions>
  *   Copyright (C) 2016 Johanna A <johanna-a@users.noreply.github.com>
  *   Copyright (C) 2013-2016 Attila Molnar <attilamolnar@hush.com>
- *   Copyright (C) 2013, 2017, 2019 Sadie Powell <sadie@witchery.services>
+ *   Copyright (C) 2013, 2017, 2019-2020 Sadie Powell <sadie@witchery.services>
  *   Copyright (C) 2012 Robby <robby@chatbelgie.be>
  *   Copyright (C) 2009 Uli Schlachter <psychon@inspircd.org>
  *   Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
@@ -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);