httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
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 
> <stas@stason.org> 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. */
>    AP_MODE_READBYTES,
>    ...

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).
      */
     AP_MODE_GETLINE,

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. */
     AP_MODE_EATCRLF,

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.:
AP_MODE_GETLINE|AP_MODE_EATCRLF and AP_MODE_READBYTES|AP_MODE_EATCRLF?

>> right? Or how otherwise would you explain the assertion:
>>
>>    AP_DEBUG_ASSERT(!APR_BRIGADE_EMPTY(bb));
> 
> 
> 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

Cool:

/** 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
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Mime
View raw message