From 96dd0a52d93219a214130c18fe34bb81ce5acdbd Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Wed, 11 Feb 2015 17:09:59 +0100 Subject: Convert the HTTPd ACL event to use the new cross-module event system --- src/modules/m_httpd.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/modules/m_httpd.cpp') diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index bbd9f1275..0dd028924 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -31,6 +31,7 @@ class ModuleHttpServer; static ModuleHttpServer* HttpModule; static bool claimed; static insp::intrusive_list sockets; +static Events::ModuleEventProvider* aclevprov; /** HTTP socket states */ @@ -323,9 +324,10 @@ class HttpServerSocket : public BufferedSocket, public Timer, public insp::intru InternalState = HTTP_SERVE_SEND_DATA; claimed = false; + ModResult MOD_RESULT; HTTPRequest acl((Module*)HttpModule, "httpd_acl", request_type, uri, &headers, this, ip, postdata); - acl.Send(); - if (!claimed) + FIRST_MOD_RESULT_CUSTOM(*aclevprov, HTTPACLEventListener, OnHTTPACLCheck, MOD_RESULT, (acl)); + if (MOD_RESULT != MOD_RES_DENY) { HTTPRequest url((Module*)HttpModule, "httpd_url", request_type, uri, &headers, this, ip, postdata); url.Send(); @@ -372,11 +374,14 @@ class ModuleHttpServer : public Module { HTTPdAPIImpl APIImpl; unsigned int timeoutsec; + Events::ModuleEventProvider acleventprov; public: ModuleHttpServer() : APIImpl(this) + , acleventprov(this, "event/http-acl") { + aclevprov = &acleventprov; } void init() CXX11_OVERRIDE -- cgit v1.3.1-10-gc9f91