The header captures had lots of pools. They have all been transformed.
#include <common/config.h>
#include <common/mini-clist.h>
-#define sizeof_capture CAPTURE_LEN
/*
* Returns a pointer to an area of <__len> bytes taken from the pool <pool> or
* dynamically allocated. In the first case, <__pool> is updated to point to
int namelen; /* length of the header name, to speed-up lookups */
int len; /* capture length, not including terminal zero */
int index; /* index in the output array */
- void *pool; /* pool of pre-allocated memory area of (len+1) bytes */
+ struct pool_head *pool; /* pool of pre-allocated memory area of (len+1) bytes */
};
extern struct pool_head *pool2_capture;
int nb_req_cap, nb_rsp_cap; /* # of headers to be captured */
struct cap_hdr *req_cap; /* chained list of request headers to be captured */
struct cap_hdr *rsp_cap; /* chained list of response headers to be captured */
- void *req_cap_pool, *rsp_cap_pool; /* pools of pre-allocated char ** used to build the sessions */
+ struct pool_head *req_cap_pool, /* pools of pre-allocated char ** used to build the sessions */
+ *rsp_cap_pool;
void *hdr_idx_pool; /* pools of pre-allocated int* used for headers indexing */
char *req_add[MAX_NEWHDR], *rsp_add[MAX_NEWHDR]; /* headers to be added */
int grace; /* grace time after stop request */
hdr->name = strdup(args[3]);
hdr->namelen = strlen(args[3]);
hdr->len = atol(args[5]);
+ hdr->pool = create_pool("caphdr", hdr->len + 1, MEM_F_SHARED);
hdr->index = curproxy->nb_req_cap++;
curproxy->req_cap = hdr;
curproxy->to_log |= LW_REQHDR;
hdr->name = strdup(args[3]);
hdr->namelen = strlen(args[3]);
hdr->len = atol(args[5]);
+ hdr->pool = create_pool("caphdr", hdr->len + 1, MEM_F_SHARED);
hdr->index = curproxy->nb_rsp_cap++;
curproxy->rsp_cap = hdr;
curproxy->to_log |= LW_RSPHDR;
memcpy(curproxy->check_req, sslv3_client_hello_pkt, sizeof(sslv3_client_hello_pkt));
}
+ /* The small pools required for the capture lists */
+ if (curproxy->nb_req_cap)
+ curproxy->req_cap_pool = create_pool("ptrcap",
+ curproxy->nb_req_cap * sizeof(char *),
+ MEM_F_SHARED);
+ if (curproxy->nb_rsp_cap)
+ curproxy->rsp_cap_pool = create_pool("ptrcap",
+ curproxy->nb_rsp_cap * sizeof(char *),
+ MEM_F_SHARED);
+
/* for backwards compatibility with "listen" instances, if
* fullconn is not set but maxconn is set, then maxconn
* is used.
txn->hdr_idx.size = MAX_HTTP_HDR;
if (p->nb_req_cap > 0) {
- if ((txn->req.cap =
- pool_alloc_from(p->req_cap_pool, p->nb_req_cap*sizeof(char *)))
- == NULL) { /* no memory */
+ if ((txn->req.cap = pool_alloc2(p->req_cap_pool)) == NULL) {
+ /* no memory */
close(cfd); /* nothing can be done for this fd without memory */
pool_free2(pool2_task, t);
pool_free2(pool2_session, s);
if (p->nb_rsp_cap > 0) {
- if ((txn->rsp.cap =
- pool_alloc_from(p->rsp_cap_pool, p->nb_rsp_cap*sizeof(char *)))
- == NULL) { /* no memory */
+ if ((txn->rsp.cap = pool_alloc2(p->rsp_cap_pool)) == NULL) {
+ /* no memory */
if (txn->req.cap != NULL)
- pool_free_to(p->req_cap_pool, txn->req.cap);
+ pool_free2(p->req_cap_pool, txn->req.cap);
close(cfd); /* nothing can be done for this fd without memory */
pool_free2(pool2_task, t);
pool_free2(pool2_session, s);
pool_alloc_from(p->hdr_idx_pool, txn->hdr_idx.size*sizeof(*txn->hdr_idx.v)))
== NULL) { /* no memory */
if (txn->rsp.cap != NULL)
- pool_free_to(p->rsp_cap_pool, txn->rsp.cap);
+ pool_free2(p->rsp_cap_pool, txn->rsp.cap);
if (txn->req.cap != NULL)
- pool_free_to(p->req_cap_pool, txn->req.cap);
+ pool_free2(p->req_cap_pool, txn->req.cap);
close(cfd); /* nothing can be done for this fd without memory */
pool_free2(pool2_task, t);
pool_free2(pool2_session, s);
if (txn->hdr_idx.v != NULL)
pool_free_to(p->hdr_idx_pool, txn->hdr_idx.v);
if (txn->rsp.cap != NULL)
- pool_free_to(p->rsp_cap_pool, txn->rsp.cap);
+ pool_free2(p->rsp_cap_pool, txn->rsp.cap);
if (txn->req.cap != NULL)
- pool_free_to(p->req_cap_pool, txn->req.cap);
+ pool_free2(p->req_cap_pool, txn->req.cap);
close(cfd); /* nothing can be done for this fd without memory */
pool_free2(pool2_task, t);
pool_free2(pool2_session, s);
if (txn->hdr_idx.v != NULL)
pool_free_to(p->hdr_idx_pool, txn->hdr_idx.v);
if (txn->rsp.cap != NULL)
- pool_free_to(p->rsp_cap_pool, txn->rsp.cap);
+ pool_free2(p->rsp_cap_pool, txn->rsp.cap);
if (txn->req.cap != NULL)
- pool_free_to(p->req_cap_pool, txn->req.cap);
+ pool_free2(p->req_cap_pool, txn->req.cap);
close(cfd); /* nothing can be done for this fd without memory */
pool_free2(pool2_task, t);
pool_free2(pool2_session, s);
h_next = h->next;
if (h->name)
free(h->name);
- pool_destroy(h->pool);
+ pool_destroy2(h->pool);
free(h);
h = h_next;
}/* end while(h) */
if (h->name)
free(h->name);
- pool_destroy(h->pool);
+ pool_destroy2(h->pool);
free(h);
h = h_next;
}/* end while(h) */
l = l_next;
}/* end while(l) */
- pool_destroy((void **) p->req_cap_pool);
- pool_destroy((void **) p->rsp_cap_pool);
+ pool_destroy2(p->req_cap_pool);
+ pool_destroy2(p->rsp_cap_pool);
p = p->next;
}/* end while(p) */
(strncasecmp(sol, h->name, h->namelen) == 0)) {
if (cap[h->index] == NULL)
cap[h->index] =
- pool_alloc_from(h->pool, h->len + 1);
+ pool_alloc2(h->pool);
if (cap[h->index] == NULL) {
Alert("HTTP capture : out of memory.\n");
struct cap_hdr *h;
for (h = s->fe->rsp_cap; h; h = h->next) {
if (txn->rsp.cap[h->index] != NULL)
- pool_free_to(h->pool, txn->rsp.cap[h->index]);
+ pool_free2(h->pool, txn->rsp.cap[h->index]);
}
- pool_free_to(s->fe->rsp_cap_pool, txn->rsp.cap);
+ pool_free2(s->fe->rsp_cap_pool, txn->rsp.cap);
}
if (txn->req.cap != NULL) {
struct cap_hdr *h;
for (h = s->fe->req_cap; h; h = h->next) {
if (txn->req.cap[h->index] != NULL)
- pool_free_to(h->pool, txn->req.cap[h->index]);
+ pool_free2(h->pool, txn->req.cap[h->index]);
}
- pool_free_to(s->fe->req_cap_pool, txn->req.cap);
+ pool_free2(s->fe->req_cap_pool, txn->req.cap);
}
if (txn->uri)