httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <>
Subject Re: should input filter return the exact amount of bytes asked for?
Date Tue, 11 Nov 2003 17:24:40 GMT
At 03:31 AM 11/11/2003, Justin Erenkrantz wrote:
>On Tue, Nov 04, 2003 at 01:41:46AM -0800, Stas Bekman wrote:
>> filter. What happens if the filter returns less bytes (while there is still 
>> more data coming?) What happens if the filter returns more bytes than 
>> requested (e.g. because it uncompressed some data). After all the incoming 
>Less bytes = OK.

But not great if there is more incoming data available (consider that one
can call with NONBLOCK and dig up some more.  There is a balance to be
found here, one doesn't want to slurp 15mb of a file at onces, but one doesn't
want bytes to trickle up one at a time.

>Same bytes = OK.

Of course

>More bytes = Not OK.  (Theoretically possible though with bad filters.)

Wrong.  This is OK across the board, please consider;

module requests 1000 arbitrary bytes;

  codepage module requests 1000

    http reads one 'chunk' available, 8000 bytes
    and will return that page

  codepage can translate 7998 bytes and comes to
  a screeching halt for a 3 byte sequence.  returns
  our Now Translated 4000 bytes

module sees a 4000 byte heap bucket.

What can you do?  Instead of treating that bucket as a singleton
when you want 1000 bytes, consume the first 1000 bytes from that
bucket (or the brigade.)

Please review the archives for this discussion (the brigades on the
apr list, the filter api on httpd.)  This was a very long thread, but the
net result of filters is that you get what is available/handy, not any
specific number of bytes.


View raw message