httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Erenkrantz <jerenkra...@apache.org>
Subject Re: [PATCH] fix LimitRequestBody for all input handlers
Date Fri, 12 Apr 2002 21:14:21 GMT
On Fri, Apr 12, 2002 at 01:59:59PM -0700, Ryan Bloom wrote:
> I have explained three times now that there is no ap_get_brigade() path
> that actually solves the problem.  Until you create a set of functions
> that module authors can use to get data from the client, this is the
> correct solution.  Think of ap_get_client_block as being analogous to
> the handler functions.  Handlers generate content, get_client_block
> consumes it.

All a module has to do to get the input data is:

beginning:
rv = ap_get_brigade(r->input_filters, bb, AP_MODE_READBYTES, APR_BLOCK_READ,
                    YOUR_PREFERRED_CHUNK_SIZE);
if (rv != APR_SUCCESS) {
   /* something bad happened */
}
APR_BRIGADE_FOREACH(e, bb) {
   if (APR_BRIGADE_IS_EOS(e)) {
       /* we're done */ 
   }
   apr_brigade_read(e, &mybuf, &mylen);
   /* Do your stuff to mybuf */
}
goto beginning

You'll get a brigade (bb) that has the input.  When there is nothing
more (i.e. past C-L or LimitReqBody or whatnot, but you don't need to
know any of that), you'll either get EOS or an error.  You keep
looping as you get your data.  This is exactly equivalent to
ap_get_client_block(), but I believe much more powerful.

Why wouldn't this work?  All of the chunking, C-L, etc is handled
by HTTP_IN.  Yes, this means changing the modules to do the right
thing.  However, I think that should have been done a long time
ago.  -- justin

Mime
View raw message