httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <>
Subject Re: should input filter return the exact amount of bytes asked for?
Date Thu, 13 Nov 2003 19:01:57 GMT
Justin Erenkrantz wrote:
> --On Thursday, November 13, 2003 12:38 AM -0800 Stas Bekman 
> <> wrote:
>> Great. Where this should be documented? In the ap_get_brigade .h?
> It's already in util_filters.h.  Read the documentation for 
> ap_input_mode_t:
>    /** The filter should return at most readbytes data. */
>    ...

Aha! I was looking in the wrong place then. Thanks Justin.

Should we add an explicit explanation to AP_MODE_READBYTES: return at most 
readbytes data. Can't return 0 with APR_BLOCK_READ. Can't return more than 
readbytes data.

Also while we are at it I have a few more questions:

     /** The filter should return at most one line of CRLF data.
      *  (If a potential line is too long or no CRLF is found, the
      *   filter may return partial data).

does it mean that the filter should ignore the readbytes argument in this mode?

     /** The filter should implicitly eat any CRLF pairs that it sees. */

does it mean that it should do the same as AP_MODE_GETLINE but kill CRLF? If 
not how much data is it supposed to read? Or is it a mode that never goes on 
its own and should be OR'ed with some definitive mode, e.g.:

>> right? Or how otherwise would you explain the assertion:
> If using APR_BLOCK_READ, it's illegal to return 0 bytes with 
> AP_MODE_READBYTES - that is what this assert is checking for in 
> maintainer mode (this was a troublesome assert at one point).  It's the 
> same expectation as doing a blocking socking read() - blocking reads 
> shouldn't return until something is returned.  -- justin


/** Determines how a bucket or brigade should be read */
typedef enum {
     APR_BLOCK_READ,   /**< block until data becomes available */
     APR_NONBLOCK_READ /**< return immediately if no data is available */
} apr_read_type_e;

Though it'd be nice to add a note re: APR_BLOCK_READ in the AP_MODE_READBYTES 
doc above. Or I guess may be it belongs to some filters tutorial...

Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker     mod_perl Guide --->

View raw message