httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <trawi...@bellsouth.net>
Subject Re: cvs commit: apache-2.0/src/main http_protocol.c
Date Thu, 12 Oct 2000 15:46:34 GMT
rbb@covalent.net writes:

> > You didn't screw it up... I did :-)   Here I am talking about passing around
> > a parameter saying "no more than this", yet I ask about unread input.
> > 
> > hehe...
> > 
> > I see two changes pending, at least:
> > 
> > 1) Add an apr_size_t to the (input) filter function prototype
> > 2) General policy for input filters is to return *no more* than requested.
> >    If they have any excess, then it must be stored in their ctx somehow.
> 
> I am in the middle of implementing #1, and as a part of that I documented
> #2.  There is nothing we can do for #2 to enforce it, but we don't really
> have to either.  We have always allowed people to write incorrect modules,
> they just don't work in the server.  :-)

I'm not sure I agree with this design point.  

What is the purpose other than avoiding ap_get_client_block() from
having to hold onto extra data?

A filter may want to give a bucket with indeterminate length (e.g., a
pipe bucket) to the caller.  How do we the limit the amount of data in
this case?

(Example where a pipe bucket would be useful: mod_ext_filter allows
you to run an external program to scan/transform the data; once all
data has been provided to the external program, rather than using
mod_ext_filter to read from the pipe I'd prefer that mod_ext_filter
then make a pipe bucket from the pipe and have the filter that wants
to see the data do the pipe read (via e->read()).)

It seems better that filters deliver data in amounts which make sense
to them.  In the case that the receiving filter can't deal with all of
it, the receiving filter (or ap_get_client_block() in this basket
case) will have to save it aside.

While there are cases other than ap_get_client_block() when the caller
of ap_get_next_brigade() is likely not to be able to use everything
that comes back, often it is hard for a caller of ap_get_next_brigade()
to tell the other filter how much it can take in terms of bytes, as
whether or not anything would be "left over" depends on how/if the
received data has to be transformed.

-- 
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
     http://www.geocities.com/SiliconValley/Park/9289/
          Born in Roswell... married an alien...

Mime
View raw message