]> git.pld-linux.org Git - packages/apache.git/blob - apache-bug_33382.patch
- fix large memory consumption
[packages/apache.git] / apache-bug_33382.patch
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
4 @@ -1100,6 +1100,7 @@
5   
6  typedef struct core_filter_ctx {
7      apr_bucket_brigade *b;
8 +    apr_bucket_brigade *tmpbb;
9  } core_ctx_t;
10   
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))); \
17  } while (0)
18  
19 +
20 +/**
21 + * Split the contents of a brigade after bucket 'e' to an existing brigade
22 + *
23 + * XXXX: Should this function be added to APR-Util?
24 + */
25 +static void brigade_move(apr_bucket_brigade *b, apr_bucket_brigade *a,
26 +                         apr_bucket *e)
27 +{
28 +    apr_bucket *f;
29 +
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);
34 +    }
35 +
36 +    APR_BRIGADE_CHECK_CONSISTENCY(a);
37 +    APR_BRIGADE_CHECK_CONSISTENCY(b);
38 +}
39 +
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,
42                               apr_off_t readbytes)
43 @@ -3703,6 +3724,7 @@
44      {
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);
48  
49          /* seed the brigade with the client socket. */
50          e = apr_bucket_socket_create(net->client_socket, f->c->bucket_alloc);
51 @@ -3814,7 +3836,6 @@
52      /* read up to the amount they specified. */
53      if (mode == AP_MODE_READBYTES || mode == AP_MODE_SPECULATIVE) {
54          apr_bucket *e;
55 -        apr_bucket_brigade *newbb;
56  
57          AP_DEBUG_ASSERT(readbytes > 0);
58  
59 @@ -3855,8 +3876,8 @@
60              return rv;
61          }
62  
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);
67  
68          if (mode == AP_MODE_READBYTES) {
69              APR_BRIGADE_CONCAT(b, ctx->b);
70 @@ -3873,7 +3894,7 @@
71          }
72  
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);
76      }
77      return APR_SUCCESS;
78  }
This page took 0.030673 seconds and 3 git commands to generate.