diff options
Diffstat (limited to 'src/modules/m_httpd_stats.cpp')
-rw-r--r-- | src/modules/m_httpd_stats.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 35a4b0fb2..ad0b4bb72 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -25,14 +25,15 @@ #include "modules/httpd.h" #include "xline.h" -class ModuleHttpStats : public Module +class ModuleHttpStats : public Module, public HTTPRequestEventListener { static const insp::flat_map<char, char const*>& entities; HTTPdAPI API; public: ModuleHttpStats() - : API(this) + : HTTPRequestEventListener(this) + , API(this) { } @@ -87,14 +88,12 @@ class ModuleHttpStats : public Module data << "</metadata>"; } - void OnEvent(Event& event) CXX11_OVERRIDE + ModResult HandleRequest(HTTPRequest* http) { std::stringstream data(""); - if (event.id == "httpd_url") { ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Handling httpd event"); - HTTPRequest* http = (HTTPRequest*)&event; if ((http->GetURI() == "/stats") || (http->GetURI() == "/stats/")) { @@ -225,8 +224,15 @@ class ModuleHttpStats : public Module response.headers.SetHeader("X-Powered-By", MODNAME); response.headers.SetHeader("Content-Type", "text/xml"); API->SendResponse(response); + return MOD_RES_DENY; // Handled } } + return MOD_RES_PASSTHRU; + } + + ModResult OnHTTPRequest(HTTPRequest& req) CXX11_OVERRIDE + { + return HandleRequest(&req); } Version GetVersion() CXX11_OVERRIDE |