From 086b3b4c9f1ba70abe2a8ad822fd7c1f735aed7d Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sun, 13 May 2007 21:45:51 +0200 Subject: [PATCH] [MAJOR] ported the captures to use the new mempool v2 The "capture.c" file has also been removed since it was empty. --- Makefile | 2 +- Makefile.bsd | 2 +- Makefile.osx | 2 +- include/types/capture.h | 5 +++-- src/capture.c | 26 -------------------------- src/haproxy.c | 2 +- src/proto_http.c | 6 ++++-- src/session.c | 4 ++-- 8 files changed, 13 insertions(+), 36 deletions(-) delete mode 100644 src/capture.c diff --git a/Makefile b/Makefile index 122f1c6fa..37439c30e 100644 --- a/Makefile +++ b/Makefile @@ -215,7 +215,7 @@ all: haproxy OBJS = src/haproxy.o src/list.o src/chtbl.o src/hashpjw.o src/base64.o \ src/uri_auth.o src/standard.o src/buffers.o src/log.o src/task.o \ src/time.o src/fd.o src/regex.o src/cfgparse.o src/server.o \ - src/checks.o src/queue.o src/capture.o src/client.o src/proxy.o \ + src/checks.o src/queue.o src/client.o src/proxy.o \ src/proto_http.o src/stream_sock.o src/appsession.o src/backend.o \ src/session.o src/hdr_idx.o src/ev_select.o src/acl.o src/memory.o diff --git a/Makefile.bsd b/Makefile.bsd index 945b08e24..cc8004086 100644 --- a/Makefile.bsd +++ b/Makefile.bsd @@ -85,7 +85,7 @@ LDFLAGS = -g OBJS = src/haproxy.o src/list.o src/chtbl.o src/hashpjw.o src/base64.o \ src/uri_auth.o src/standard.o src/buffers.o src/log.o src/task.o \ src/time.o src/fd.o src/regex.o src/cfgparse.o src/server.o \ - src/checks.o src/queue.o src/capture.o src/client.o src/proxy.o \ + src/checks.o src/queue.o src/client.o src/proxy.o \ src/proto_http.o src/stream_sock.o src/appsession.o src/backend.o \ src/session.o src/hdr_idx.o src/ev_select.o src/ev_poll.o \ src/ev_kqueue.o src/acl.o src/memory.o diff --git a/Makefile.osx b/Makefile.osx index 0618e68c9..5cf4f08fd 100644 --- a/Makefile.osx +++ b/Makefile.osx @@ -85,7 +85,7 @@ LDFLAGS = -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386 OBJS = src/haproxy.o src/list.o src/chtbl.o src/hashpjw.o src/base64.o \ src/uri_auth.o src/standard.o src/buffers.o src/log.o src/task.o \ src/time.o src/fd.o src/regex.o src/cfgparse.o src/server.o \ - src/checks.o src/queue.o src/capture.o src/client.o src/proxy.o \ + src/checks.o src/queue.o src/client.o src/proxy.o \ src/proto_http.o src/stream_sock.o src/appsession.o src/backend.o \ src/session.o src/hdr_idx.o src/ev_select.o src/ev_poll.o src/acl.o \ src/memory.o diff --git a/include/types/capture.h b/include/types/capture.h index d0271a2e2..49f4d535a 100644 --- a/include/types/capture.h +++ b/include/types/capture.h @@ -2,7 +2,7 @@ include/types/capture.h This file defines everything related to captures. - Copyright (C) 2000-2006 Willy Tarreau - w@1wt.eu + Copyright (C) 2000-2007 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 @@ -23,6 +23,7 @@ #define _TYPES_CAPTURE_H #include +#include struct cap_hdr { struct cap_hdr *next; @@ -33,7 +34,7 @@ struct cap_hdr { void *pool; /* pool of pre-allocated memory area of (len+1) bytes */ }; -extern void **pool_capture; +extern struct pool_head *pool2_capture; #endif /* _TYPES_CAPTURE_H */ diff --git a/src/capture.c b/src/capture.c deleted file mode 100644 index c0c4a75f5..000000000 --- a/src/capture.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Capture variables and functions. - * - * Copyright 2000-2006 Willy Tarreau - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * - */ - -#include - -#include -#include - -void **pool_capture = NULL; - - -/* - * Local variables: - * c-indent-level: 8 - * c-basic-offset: 8 - * End: - */ diff --git a/src/haproxy.c b/src/haproxy.c index ed26a54e5..344238976 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -666,7 +666,7 @@ void deinit(void) pool_destroy2(pool2_buffer); pool_destroy2(pool2_requri); pool_destroy2(pool2_task); - pool_destroy(pool_capture); + pool_destroy2(pool2_capture); pool_destroy2(pool2_appsess); pool_destroy2(pool2_pendconn); diff --git a/src/proto_http.c b/src/proto_http.c index 39d2a463a..64ab50799 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -246,6 +246,7 @@ void init_proto_http() /* memory allocations */ pool2_requri = create_pool("requri", REQURI_LEN, MEM_F_SHARED); + pool2_capture = create_pool("capture", CAPTURE_LEN, MEM_F_SHARED); } /* @@ -628,6 +629,7 @@ const char sess_set_cookie[8] = "N1I3PD5R"; /* No set-cookie, unknown, Set-Cooki Set-cookie seen and left unchanged (passive), Set-cookie Deleted, unknown, Set-cookie Rewritten */ struct pool_head *pool2_requri; +struct pool_head *pool2_capture; /* * send a log for the session when we have enough info about it. @@ -4172,7 +4174,7 @@ void manage_client_side_cookies(struct session *t, struct buffer *req) memcmp(p1, t->fe->capture_name, t->fe->capture_namelen) == 0) { int log_len = p4 - p1; - if ((txn->cli_cookie = pool_alloc(capture)) == NULL) { + if ((txn->cli_cookie = pool_alloc2(pool2_capture)) == NULL) { Alert("HTTP logging : out of memory.\n"); } else { if (log_len > t->fe->capture_len) @@ -4707,7 +4709,7 @@ void manage_server_side_cookies(struct session *t, struct buffer *rtr) memcmp(p1, t->be->capture_name, t->be->capture_namelen) == 0) { int log_len = p4 - p1; - if ((txn->srv_cookie = pool_alloc(capture)) == NULL) { + if ((txn->srv_cookie = pool_alloc2(pool2_capture)) == NULL) { Alert("HTTP logging : out of memory.\n"); } diff --git a/src/session.c b/src/session.c index 4efc1cebe..38889c4e2 100644 --- a/src/session.c +++ b/src/session.c @@ -67,9 +67,9 @@ void session_free(struct session *s) if (txn->uri) pool_free2(pool2_requri, txn->uri); if (txn->cli_cookie) - pool_free(capture, txn->cli_cookie); + pool_free2(pool2_capture, txn->cli_cookie); if (txn->srv_cookie) - pool_free(capture, txn->srv_cookie); + pool_free2(pool2_capture, txn->srv_cookie); pool_free2(pool2_session, s); }