On Wed, 2002-10-16 at 17:54, Brian Pane wrote:
> I think you could achieve this result by appending a bucket of type
> apr_bucket_flush to the output brigade. I think that would be a
> reasonable workaround for 2.0.
This is what I wanted to do initially:
---------------------------------------------------
static apr_status_t logio_out_filter(ap_filter_t *f,
apr_bucket_brigade *bb) {
apr_bucket *e = APR_BRIGADE_LAST(bb);
/* End of data, make sure we flush */
if (APR_BUCKET_IS_EOS(e)) {
APR_BRIGADE_INSERT_TAIL(bb,
apr_bucket_flush_create(f->c->bucket_alloc));
APR_BUCKET_REMOVE(e);
apr_bucket_destroy(e);
}
return ap_pass_brigade(f->next, bb);
}
---------------------------------------------------
But then I thought, if the last bucket is EOS, we'll be sending the
stuff out anyway. Or maybe I'm wrong there? If so, then this might be
better:
---------------------------------------------------
static apr_status_t logio_out_filter(ap_filter_t *f,
apr_bucket_brigade *bb) {
APR_BRIGADE_INSERT_TAIL(bb,
apr_bucket_flush_create(f->c->bucket_alloc));
return ap_pass_brigade(f->next, bb);
}
---------------------------------------------------
Even tried this (insert FLUSH before EOS):
---------------------------------------------------
static apr_status_t logio_out_filter(ap_filter_t *f,
apr_bucket_brigade *bb) {
apr_bucket *e = APR_BRIGADE_LAST(bb);
/* End of data, make sure we flush */
if (APR_BUCKET_IS_EOS(e)) {
APR_BUCKET_INSERT_BEFORE(
apr_bucket_flush_create(f->c->bucket_alloc), e);
}
return ap_pass_brigade(f->next, bb);
}
---------------------------------------------------
But this last one makes Apache go into 100% CPU utilisation after the
first ever request has been served. So, this is bad for sure!
The first one works fine, but I have to admit that I don't know how to
simulate requests that would normally be buffered, which makes my
testing completely useless. Any input is appreciated...
Bojan