From: Willy Tarreau Date: Sun, 13 May 2007 19:36:56 +0000 (+0200) Subject: [MAJOR] ported requri to use mempools v2 X-Git-Tag: v1.3.11~1^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=332f8bfc5b992472b2f6df58732cd8e6140a4671;p=thirdparty%2Fhaproxy.git [MAJOR] ported requri to use mempools v2 --- diff --git a/include/common/memory.h b/include/common/memory.h index 0f142f0284..c50ab9a837 100644 --- a/include/common/memory.h +++ b/include/common/memory.h @@ -27,7 +27,6 @@ #include #include -#define sizeof_requri REQURI_LEN #define sizeof_capture CAPTURE_LEN /* * Returns a pointer to an area of <__len> bytes taken from the pool or diff --git a/include/proto/log.h b/include/proto/log.h index 4ed56ddf3d..1a02ec1220 100644 --- a/include/proto/log.h +++ b/include/proto/log.h @@ -27,10 +27,13 @@ #include #include +#include #include #include #include +extern struct pool_head *pool2_requri; + /* * Displays the message on stderr with the date and pid. Overrides the quiet * mode during startup. diff --git a/include/types/log.h b/include/types/log.h index dc04e65807..12f8e27675 100644 --- a/include/types/log.h +++ b/include/types/log.h @@ -44,8 +44,6 @@ #define LW_REQHDR 1024 /* request header(s) */ #define LW_RSPHDR 2048 /* response header(s) */ -extern void **pool_requri; - #endif /* _TYPES_LOG_H */ diff --git a/src/haproxy.c b/src/haproxy.c index 7f5641c4f5..ed26a54e5b 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -664,7 +664,7 @@ void deinit(void) pool_destroy2(pool2_session); pool_destroy2(pool2_buffer); - pool_destroy(pool_requri); + pool_destroy2(pool2_requri); pool_destroy2(pool2_task); pool_destroy(pool_capture); pool_destroy2(pool2_appsess); diff --git a/src/proto_http.c b/src/proto_http.c index 51d265cb90..39d2a463a4 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -243,6 +243,9 @@ void init_proto_http() FD_SET(*tmp, url_encode_map); tmp++; } + + /* memory allocations */ + pool2_requri = create_pool("requri", REQURI_LEN, MEM_F_SHARED); } /* @@ -624,7 +627,7 @@ const char sess_cookie[4] = "NIDV"; /* No cookie, Invalid cookie, cookie fo const char sess_set_cookie[8] = "N1I3PD5R"; /* No set-cookie, unknown, Set-Cookie Inserted, unknown, Set-cookie seen and left unchanged (passive), Set-cookie Deleted, unknown, Set-cookie Rewritten */ -void **pool_requri = NULL; +struct pool_head *pool2_requri; /* * send a log for the session when we have enough info about it. @@ -1592,7 +1595,7 @@ int process_cli(struct session *t) */ if (unlikely(t->logs.logwait & LW_REQ)) { /* we have a complete HTTP request that we must log */ - if ((txn->uri = pool_alloc(requri)) != NULL) { + if ((txn->uri = pool_alloc2(pool2_requri)) != NULL) { int urilen = msg->sl.rq.l; if (urilen >= REQURI_LEN) diff --git a/src/session.c b/src/session.c index 1b574a00bb..4efc1cebe7 100644 --- a/src/session.c +++ b/src/session.c @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -64,7 +65,7 @@ void session_free(struct session *s) } if (txn->uri) - pool_free(requri, txn->uri); + pool_free2(pool2_requri, txn->uri); if (txn->cli_cookie) pool_free(capture, txn->cli_cookie); if (txn->srv_cookie)