..
> +static int do_store_body(cache_request_rec *cache,
> + ap_filter_t *f,
> + apr_bucket_brigade *in) {
> + apr_bucket *e;
> + apr_bucket_brigade *bb;
> + apr_status_t rv, rv2;
> + cache_server_conf *conf;
> +
> + conf = (cache_server_conf *)
> ap_get_module_config(f->r->server->module_config,
> + &cache_module);
> +
> + /* try split any buckets larger than threshold */
> + rv = APR_SUCCESS; /* successful unless found otherwise */
> + rv2 = APR_SUCCESS;
> + if (conf->maxbucketsize > 0) {
> + e = APR_BRIGADE_FIRST(in);
> + while (e != APR_BRIGADE_SENTINEL(in)) {
&& (rv == APR_SUCCESS && rv2 == APR_SUCCESS) {
Otherwise we may keep walking through the brigade unnecessarily.
> +
> + /* if necessary, split the brigade and send what we have so far
> */
> + if (APR_SUCCESS == apr_bucket_split(e, conf->maxbucketsize)) {
> + e = APR_BUCKET_NEXT(e);
> + bb = in;
> + in = apr_brigade_split(bb, e);
> +
> + /* if store body fails, don't try store body again */
> + if (APR_SUCCESS == rv) {
Drop if.
> + rv = cache->provider->store_body(cache->handle, f->r,
> bb);
> + }
> +
> + /* try write split brigade to the filter stack and network */
> + if (APR_SUCCESS == rv2) {
Drop if.
> + rv2 = ap_pass_brigade(f->next, bb);
> + }
> + apr_brigade_destroy(bb);
> + }
> + else {
> + e = APR_BUCKET_NEXT(e);
> + }
> + }
> + }
> +
Nice patch.
--
Davi Arnaut