#include "xline.h"
#include "protocol.h"
-/* $ModDesc: Provides statistics over HTTP via m_httpd.so */
-
class ModuleHttpStats : public Module
{
static std::map<char, char const*> const &entities;
+ HTTPdAPI API;
public:
+ ModuleHttpStats()
+ : API(this)
+ {
+ }
void init() CXX11_OVERRIDE
{
if (event.id == "httpd_url")
{
- ServerInstance->Logs->Log("m_http_stats", LOG_DEBUG,"Handling httpd event");
+ ServerInstance->Logs->Log("m_http_stats", LOG_DEBUG, "Handling httpd event");
HTTPRequest* http = (HTTPRequest*)&event;
if ((http->GetURI() == "/stats") || (http->GetURI() == "/stats/"))
HTTPDocumentResponse response(this, *http, &data, 200);
response.headers.SetHeader("X-Powered-By", "m_httpd_stats.so");
response.headers.SetHeader("Content-Type", "text/xml");
- response.Send();
+ API->SendResponse(response);
}
}
}