From: Andrzej Augustynowicz Date: Tue, 8 Mar 2005 23:20:23 +0000 (+0000) Subject: - fix large memory consumption X-Git-Tag: auto/ac/apache-2_0_53-4~3 X-Git-Url: http://git.pld-linux.org/?p=packages%2Fapache.git;a=commitdiff_plain;h=5e060a735f40402ea2093455634fac7759d15ea9 - fix large memory consumption Changed files: apache-bug_33382.patch -> 1.1 --- diff --git a/apache-bug_33382.patch b/apache-bug_33382.patch new file mode 100644 index 0000000..e150fc5 --- /dev/null +++ b/apache-bug_33382.patch @@ -0,0 +1,78 @@ +diff -Nur old/include/httpd.h new/include/httpd.h +--- old/include/httpd.h 2005-02-04 20:21:18.000000000 +0000 ++++ new/include/httpd.h 2005-03-08 15:23:11.000000000 +0000 +@@ -1100,6 +1100,7 @@ + + typedef struct core_filter_ctx { + apr_bucket_brigade *b; ++ apr_bucket_brigade *tmpbb; + } core_ctx_t; + + typedef struct core_net_rec { +diff -Nur old/server/core.c new/server/core.c +--- old/server/core.c 2005-02-04 20:21:18.000000000 +0000 ++++ new/server/core.c 2005-03-08 15:37:56.000000000 +0000 +@@ -3674,6 +3674,27 @@ + } while (!APR_BRIGADE_EMPTY(b) && (e != APR_BRIGADE_SENTINEL(b))); \ + } while (0) + ++ ++/** ++ * Split the contents of a brigade after bucket 'e' to an existing brigade ++ * ++ * XXXX: Should this function be added to APR-Util? ++ */ ++static void brigade_move(apr_bucket_brigade *b, apr_bucket_brigade *a, ++ apr_bucket *e) ++{ ++ apr_bucket *f; ++ ++ if (e != APR_BRIGADE_SENTINEL(b)) { ++ f = APR_RING_LAST(&b->list); ++ APR_RING_UNSPLICE(e, f, link); ++ APR_RING_SPLICE_HEAD(&a->list, e, f, apr_bucket, link); ++ } ++ ++ APR_BRIGADE_CHECK_CONSISTENCY(a); ++ APR_BRIGADE_CHECK_CONSISTENCY(b); ++} ++ + static int core_input_filter(ap_filter_t *f, apr_bucket_brigade *b, + ap_input_mode_t mode, apr_read_type_e block, + apr_off_t readbytes) +@@ -3703,6 +3724,7 @@ + { + ctx = apr_pcalloc(f->c->pool, sizeof(*ctx)); + ctx->b = apr_brigade_create(f->c->pool, f->c->bucket_alloc); ++ ctx->tmpbb = apr_brigade_create(ctx->b->p, ctx->b->bucket_alloc); + + /* seed the brigade with the client socket. */ + e = apr_bucket_socket_create(net->client_socket, f->c->bucket_alloc); +@@ -3814,7 +3836,6 @@ + /* read up to the amount they specified. */ + if (mode == AP_MODE_READBYTES || mode == AP_MODE_SPECULATIVE) { + apr_bucket *e; +- apr_bucket_brigade *newbb; + + AP_DEBUG_ASSERT(readbytes > 0); + +@@ -3855,8 +3876,8 @@ + return rv; + } + +- /* Must do split before CONCAT */ +- newbb = apr_brigade_split(ctx->b, e); ++ /* Must do move before CONCAT */ ++ brigade_move(ctx->b, ctx->tmpbb, e); + + if (mode == AP_MODE_READBYTES) { + APR_BRIGADE_CONCAT(b, ctx->b); +@@ -3873,7 +3894,7 @@ + } + + /* Take what was originally there and place it back on ctx->b */ +- APR_BRIGADE_CONCAT(ctx->b, newbb); ++ APR_BRIGADE_CONCAT(ctx->b, ctx->tmpbb); + } + return APR_SUCCESS; + }