class ModuleHttpServer;
static ModuleHttpServer* HttpModule;
-static bool claimed;
static insp::intrusive_list<HttpServerSocket> sockets;
static Events::ModuleEventProvider* aclevprov;
static Events::ModuleEventProvider* reqevprov;
{
InternalState = HTTP_SERVE_SEND_DATA;
- claimed = false;
ModResult MOD_RESULT;
- HTTPRequest acl((Module*)HttpModule, "httpd_acl", request_type, uri, &headers, this, ip, postdata);
+ HTTPRequest acl(request_type, uri, &headers, this, ip, postdata);
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);
+ HTTPRequest url(request_type, uri, &headers, this, ip, postdata);
FIRST_MOD_RESULT_CUSTOM(*reqevprov, HTTPRequestEventListener, OnHTTPRequest, MOD_RESULT, (url));
if (MOD_RESULT == MOD_RES_PASSTHRU)
{
void SendResponse(HTTPDocumentResponse& resp) CXX11_OVERRIDE
{
- claimed = true;
resp.src.sock->Page(resp.document, resp.responsecode, &resp.headers);
}
};
return MOD_RES_ALLOW;
}
+ void OnUnloadModule(Module* mod)
+ {
+ for (insp::intrusive_list<HttpServerSocket>::const_iterator i = sockets.begin(); i != sockets.end(); )
+ {
+ HttpServerSocket* sock = *i;
+ ++i;
+ if (sock->GetIOHook() && sock->GetIOHook()->prov->creator == mod)
+ {
+ sock->cull();
+ delete sock;
+ }
+ }
+ }
+
CullResult cull() CXX11_OVERRIDE
{
for (insp::intrusive_list<HttpServerSocket>::const_iterator i = sockets.begin(); i != sockets.end(); ++i)