/*
- include/proto/hdr_idx.h
- This file defines function prototypes for fast header indexation.
-
- Copyright (C) 2000-2006 Willy Tarreau - w@1wt.eu
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation, version 2.1
- exclusively.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
+ * include/proto/hdr_idx.h
+ * This file defines function prototypes for fast header indexation.
+ *
+ * Copyright (C) 2000-2011 Willy Tarreau - w@1wt.eu
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, version 2.1
+ * exclusively.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
#ifndef _PROTO_HDR_IDX_H
#define _PROTO_HDR_IDX_H
#include <common/config.h>
#include <types/hdr_idx.h>
+extern struct pool_head *pool2_hdr_idx;
+
/*
* Initialize the list pointers.
* list->size must already be set. If list->size is set and list->v is
struct cap_hdr *rsp_cap; /* chained list of response headers to be captured */
struct pool_head *req_cap_pool, /* pools of pre-allocated char ** used to build the sessions */
*rsp_cap_pool;
- struct pool_head *hdr_idx_pool; /* pools of pre-allocated int* used for headers indexing */
struct list req_add, rsp_add; /* headers to be added */
struct pxcounters be_counters; /* backend statistics counters */
struct pxcounters fe_counters; /* frontend statistics counters */
#include <proto/checks.h>
#include <proto/dumpstats.h>
#include <proto/frontend.h>
+#include <proto/hdr_idx.h>
#include <proto/lb_chash.h>
#include <proto/lb_fwlc.h>
#include <proto/lb_fwrr.h>
curproxy->nb_rsp_cap * sizeof(char *),
MEM_F_SHARED);
- curproxy->hdr_idx_pool = create_pool("hdr_idx",
- MAX_HTTP_HDR * sizeof(struct hdr_idx_elem),
- MEM_F_SHARED);
-
/* first, we will invert the servers list order */
newsrv = NULL;
while (curproxy->srv) {
}
}
+ pool2_hdr_idx = create_pool("hdr_idx",
+ MAX_HTTP_HDR * sizeof(struct hdr_idx_elem),
+ MEM_F_SHARED);
+
if (cfgerr > 0)
err_code |= ERR_ALERT | ERR_FATAL;
out:
*/
s->txn.hdr_idx.size = MAX_HTTP_HDR;
- if (unlikely((s->txn.hdr_idx.v = pool_alloc2(s->fe->hdr_idx_pool)) == NULL))
+ if (unlikely((s->txn.hdr_idx.v = pool_alloc2(pool2_hdr_idx)) == NULL))
goto out_free_rspcap; /* no memory */
/* and now initialize the HTTP transaction state */
#include <proto/buffers.h>
#include <proto/checks.h>
#include <proto/fd.h>
+#include <proto/hdr_idx.h>
#include <proto/log.h>
#include <proto/protocols.h>
#include <proto/proto_http.h>
pool_destroy2(p->req_cap_pool);
pool_destroy2(p->rsp_cap_pool);
- pool_destroy2(p->hdr_idx_pool);
pool_destroy2(p->table.pool);
p0 = p;
pool_destroy2(pool2_appsess);
pool_destroy2(pool2_pendconn);
pool_destroy2(pool2_sig_handlers);
+ pool_destroy2(pool2_hdr_idx);
if (have_appsession) {
pool_destroy2(apools.serverid);
/*
* Header indexation functions.
*
- * Copyright 2000-2008 Willy Tarreau <w@1wt.eu>
+ * Copyright 2000-2011 Willy Tarreau <w@1wt.eu>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*/
#include <common/config.h>
+#include <common/memory.h>
#include <proto/hdr_idx.h>
+struct pool_head *pool2_hdr_idx = NULL;
/*
* Add a header entry to <list> after element <after>. <after> is ignored when
* a struct hdr_idx for it if we did not have one.
*/
if (unlikely(!s->txn.hdr_idx.v && (be->acl_requires & ACL_USE_L7_ANY))) {
- if ((s->txn.hdr_idx.v = pool_alloc2(s->fe->hdr_idx_pool)) == NULL)
+ if ((s->txn.hdr_idx.v = pool_alloc2(pool2_hdr_idx)) == NULL)
return 0; /* not enough memory */
/* and now initialize the HTTP transaction state */
s->store[i].ts = NULL;
}
+ pool_free2(pool2_hdr_idx, txn->hdr_idx.v);
if (fe) {
- pool_free2(fe->hdr_idx_pool, txn->hdr_idx.v);
pool_free2(fe->rsp_cap_pool, txn->rsp.cap);
pool_free2(fe->req_cap_pool, txn->req.cap);
}
/* We may want to free the maximum amount of pools if the proxy is stopping */
if (fe && unlikely(fe->state == PR_STSTOPPED)) {
pool_flush2(pool2_buffer);
- pool_flush2(fe->hdr_idx_pool);
+ pool_flush2(pool2_hdr_idx);
pool_flush2(pool2_requri);
pool_flush2(pool2_capture);
pool_flush2(pool2_session);