mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-16 07:56:12 +03:00
Standalone: independently destroy the connection and request pools
Add independent modsecFinishConnection API that allows you to independently destroy the connection and request pools. This is to facilitate reuse of a connection for multiple requests.
This commit is contained in:
parent
27dd513ab6
commit
dda91f1689
@ -67,6 +67,10 @@ class REQUEST_STORED_CONTEXT : public IHttpStoredContext
|
|||||||
{
|
{
|
||||||
modsecFinishRequest(m_pRequestRec);
|
modsecFinishRequest(m_pRequestRec);
|
||||||
m_pRequestRec = NULL;
|
m_pRequestRec = NULL;
|
||||||
|
}
|
||||||
|
if(m_pConnRec != NULL)
|
||||||
|
{
|
||||||
|
modsecFinishConnection(m_pConnRec);
|
||||||
m_pConnRec = NULL;
|
m_pConnRec = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1356,6 +1356,10 @@ ngx_http_modsecurity_cleanup(void *data)
|
|||||||
if (ctx->req != NULL) {
|
if (ctx->req != NULL) {
|
||||||
(void) modsecFinishRequest(ctx->req);
|
(void) modsecFinishRequest(ctx->req);
|
||||||
}
|
}
|
||||||
|
if (ctx->connection != NULL) {
|
||||||
|
(void) modsecFinishConnection(ctx->connection);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
|
@ -654,11 +654,20 @@ int modsecFinishRequest(request_rec *r) {
|
|||||||
// make sure you cleanup before calling apr_terminate()
|
// make sure you cleanup before calling apr_terminate()
|
||||||
// otherwise double-free might occur, because of the request body pool cleanup function
|
// otherwise double-free might occur, because of the request body pool cleanup function
|
||||||
//
|
//
|
||||||
apr_pool_destroy(r->connection->pool);
|
apr_pool_destroy(r->pool);
|
||||||
|
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// destroy only the connection pool
|
||||||
|
int modsecFinishConnection(conn_rec *c)
|
||||||
|
{
|
||||||
|
|
||||||
|
apr_pool_destroy(c->pool);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void modsecSetLogHook(void *obj, void (*hook)(void *obj, int level, char *str)) {
|
void modsecSetLogHook(void *obj, void (*hook)(void *obj, int level, char *str)) {
|
||||||
modsecLogObj = obj;
|
modsecLogObj = obj;
|
||||||
modsecLogHook = hook;
|
modsecLogHook = hook;
|
||||||
|
@ -58,6 +58,7 @@ void modsecInitProcess();
|
|||||||
|
|
||||||
conn_rec *modsecNewConnection();
|
conn_rec *modsecNewConnection();
|
||||||
void modsecProcessConnection(conn_rec *c);
|
void modsecProcessConnection(conn_rec *c);
|
||||||
|
int modsecFinishConnection(conn_rec *c);
|
||||||
|
|
||||||
request_rec *modsecNewRequest(conn_rec *connection, directory_config *config);
|
request_rec *modsecNewRequest(conn_rec *connection, directory_config *config);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user