You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by mt...@apache.org on 2004/09/13 13:13:29 UTC
cvs commit: httpd-2.0/modules/proxy proxy_ajp.c proxy_http.c proxy_util.c mod_proxy.h
mturk 2004/09/13 04:13:29
Modified: modules/proxy proxy_ajp.c proxy_http.c proxy_util.c
mod_proxy.h
Log:
Always use prive connection pool for allocation, and call
apr_pool_clear when the connection is closed on recycle, so
that we don't leak on persistent connections.
Revision Changes Path
1.21 +1 -1 httpd-2.0/modules/proxy/proxy_ajp.c
Index: proxy_ajp.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_ajp.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- proxy_ajp.c 11 Sep 2004 09:57:12 -0000 1.20
+++ proxy_ajp.c 13 Sep 2004 11:13:28 -0000 1.21
@@ -418,7 +418,7 @@
backend->close_on_recycle = 0;
/* Step One: Determine Who To Connect To */
- status = ap_proxy_determine_connection(p, r, conf, worker, backend, c->pool,
+ status = ap_proxy_determine_connection(p, r, conf, worker, backend,
uri, &url, proxyname, proxyport,
server_portstr,
sizeof(server_portstr));
1.198 +1 -1 httpd-2.0/modules/proxy/proxy_http.c
Index: proxy_http.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_http.c,v
retrieving revision 1.197
retrieving revision 1.198
diff -u -r1.197 -r1.198
--- proxy_http.c 9 Sep 2004 16:22:23 -0000 1.197
+++ proxy_http.c 13 Sep 2004 11:13:28 -0000 1.198
@@ -1219,7 +1219,7 @@
/* Step One: Determine Who To Connect To */
if ((status = ap_proxy_determine_connection(p, r, conf, worker, backend,
- c->pool, uri, &url, proxyname,
+ uri, &url, proxyname,
proxyport, server_portstr,
sizeof(server_portstr))) != OK)
goto cleanup;
1.151 +9 -8 httpd-2.0/modules/proxy/proxy_util.c
Index: proxy_util.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_util.c,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -r1.150 -r1.151
--- proxy_util.c 11 Sep 2004 10:50:05 -0000 1.150
+++ proxy_util.c 13 Sep 2004 11:13:28 -0000 1.151
@@ -1321,9 +1321,11 @@
/* deterimine if the connection need to be closed */
if (conn->close_on_recycle || conn->close) {
- if (conn->sock)
- apr_socket_close(conn->sock);
- conn->sock = NULL;
+ apr_pool_t *p = conn->pool;
+ apr_pool_clear(conn->pool);
+ memset(conn, 0, sizeof(proxy_conn_rec));
+ conn->pool = p;
+ conn->worker = worker;
}
#if APR_HAS_THREADS
if (worker->hmax && worker->cp->res) {
@@ -1352,7 +1354,7 @@
* when disconnecting from backend.
*/
apr_pool_create(&ctx, pool);
- conn = apr_pcalloc(ctx, sizeof(proxy_conn_rec));
+ conn = apr_pcalloc(pool, sizeof(proxy_conn_rec));
conn->pool = ctx;
conn->worker = worker;
@@ -1534,7 +1536,6 @@
proxy_server_conf *conf,
proxy_worker *worker,
proxy_conn_rec *conn,
- apr_pool_t *ppool,
apr_uri_t *uri,
char **url,
const char *proxyname,
@@ -1568,10 +1569,10 @@
*/
/* are we connecting directly, or via a proxy? */
if (proxyname) {
- conn->hostname = apr_pstrdup(ppool, proxyname);
+ conn->hostname = apr_pstrdup(conn->pool, proxyname);
conn->port = proxyport;
} else {
- conn->hostname = apr_pstrdup(ppool, uri->hostname);
+ conn->hostname = apr_pstrdup(conn->pool, uri->hostname);
conn->port = uri->port;
*url = apr_pstrcat(p, uri->path, uri->query ? "?" : "",
uri->query ? uri->query : "",
@@ -1585,7 +1586,7 @@
err = apr_sockaddr_info_get(&(conn->addr),
conn->hostname, APR_UNSPEC,
conn->port, 0,
- p);
+ conn->pool);
}
else if (!worker->cp->addr) {
/* Worker can have the single constant backend adress.
1.133 +0 -2 httpd-2.0/modules/proxy/mod_proxy.h
Index: mod_proxy.h
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/proxy/mod_proxy.h,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -r1.132 -r1.133
--- mod_proxy.h 11 Sep 2004 09:31:10 -0000 1.132
+++ mod_proxy.h 13 Sep 2004 11:13:28 -0000 1.133
@@ -495,7 +495,6 @@
* @param conf current proxy server configuration
* @param worker worker used for processing request
* @param conn proxy connection struct
- * @param ppool long living memory pool
* @param uri processed uri
* @param url request url
* @param proxyname are we connecting directly or via s proxy
@@ -508,7 +507,6 @@
proxy_server_conf *conf,
proxy_worker *worker,
proxy_conn_rec *conn,
- apr_pool_t *ppool,
apr_uri_t *uri,
char **url,
const char *proxyname,