httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: [PROPOSAL] Remove ap_*_client_block in 2.1 series
Date Tue, 16 Sep 2003 06:18:18 GMT
On Wed, Sep 10, 2003 at 10:27:42AM -0400, gregames@remulak.net wrote:
> Greg Stein wrote:
> 
> > ap_rput* should be torched as well. 
> 
> what about simplicity?  how many lines of code are required for an alternative?

Yes, the ap_r* functions are a bit simpler for the module author, but
definitely cause undue complexity within the interface.

The ap_f* functions are pretty much:

{
  brigade bb = apr_brigade_create(pool);
  
  ap_fputs(r->output_filters, bb, "hello there");
  ap_fwrite(r->output_filters, bb, buf, len);
  ...
  
  return ap_pass_brigade(r->output_filters, bb);
}

IOW, before a block of writes, create a working brigade. At the end, shove
it down the filter stack.

Of course, you also want to ensure that you brigade creation is bounded on
a per-request basis. You wouldn't want to call the function above a
million times :-) In the SVN code, we create a single brigade at the
control point where we begin to generate the response. We use it all
throughout by passing the bb around, and then pass it at the end of the
response function. It is actually quite clean. (and usually
r->output_filters is already deref'd to an ap_filter_t named 'output').

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Mime
View raw message