1 diff -Nur old/include/httpd.h new/include/httpd.h
2 --- old/include/httpd.h 2005-02-04 20:21:18.000000000 +0000
3 +++ new/include/httpd.h 2005-03-08 15:23:11.000000000 +0000
6 typedef struct core_filter_ctx {
8 + apr_bucket_brigade *tmpbb;
11 typedef struct core_net_rec {
12 diff -Nur old/server/core.c new/server/core.c
13 --- old/server/core.c 2005-02-04 20:21:18.000000000 +0000
14 +++ new/server/core.c 2005-03-08 15:37:56.000000000 +0000
15 @@ -3674,6 +3674,27 @@
16 } while (!APR_BRIGADE_EMPTY(b) && (e != APR_BRIGADE_SENTINEL(b))); \
21 + * Split the contents of a brigade after bucket 'e' to an existing brigade
23 + * XXXX: Should this function be added to APR-Util?
25 +static void brigade_move(apr_bucket_brigade *b, apr_bucket_brigade *a,
30 + if (e != APR_BRIGADE_SENTINEL(b)) {
31 + f = APR_RING_LAST(&b->list);
32 + APR_RING_UNSPLICE(e, f, link);
33 + APR_RING_SPLICE_HEAD(&a->list, e, f, apr_bucket, link);
36 + APR_BRIGADE_CHECK_CONSISTENCY(a);
37 + APR_BRIGADE_CHECK_CONSISTENCY(b);
40 static int core_input_filter(ap_filter_t *f, apr_bucket_brigade *b,
41 ap_input_mode_t mode, apr_read_type_e block,
45 ctx = apr_pcalloc(f->c->pool, sizeof(*ctx));
46 ctx->b = apr_brigade_create(f->c->pool, f->c->bucket_alloc);
47 + ctx->tmpbb = apr_brigade_create(ctx->b->p, ctx->b->bucket_alloc);
49 /* seed the brigade with the client socket. */
50 e = apr_bucket_socket_create(net->client_socket, f->c->bucket_alloc);
52 /* read up to the amount they specified. */
53 if (mode == AP_MODE_READBYTES || mode == AP_MODE_SPECULATIVE) {
55 - apr_bucket_brigade *newbb;
57 AP_DEBUG_ASSERT(readbytes > 0);
63 - /* Must do split before CONCAT */
64 - newbb = apr_brigade_split(ctx->b, e);
65 + /* Must do move before CONCAT */
66 + brigade_move(ctx->b, ctx->tmpbb, e);
68 if (mode == AP_MODE_READBYTES) {
69 APR_BRIGADE_CONCAT(b, ctx->b);
73 /* Take what was originally there and place it back on ctx->b */
74 - APR_BRIGADE_CONCAT(ctx->b, newbb);
75 + APR_BRIGADE_CONCAT(ctx->b, ctx->tmpbb);