Hi Nick, Thanks a lot for the suggestions. What are "streaming bucket types"? For the buckets that nonblocking read returns success and zero, I tried blocking read again and it still returns success and zero length, so I just pass it to process the next bucket. It seems to work fine. Not sure why there are zero length heap buckets. I have also seen cases where apr_bucket_read() for heap bucket returns a length larger than 8192, e.g. 8271, and processing of this buffer caused a segmentation fault due to address out of bound. Any idea why this could happen? I thought all bucket has a size less than 8192. BTW, your apache book has been very helpful to me. Thanks for the good work! Regards, Christina Nick Kew wrote: On Sat, 12 Jan 2008 19:18:10 -0500 Christina Fu <[EMAIL PROTECTED]> wrote:Hi, I am writing a connection level input and output filter. I have confusions about whether to use APR_NONBLOCK_READ or APR_BLOCK_READ when calling apr_bucket_read() function. Could someone advise the guidelines of using blocking vs non-blocking bucket read?There's nothing specific to Apache. Blocking reads are easier to work with, but preclude certain forms of optimisation.I have seen situations when I use APR_NONBLOCK_READ to read a heap bucket, it returns status of APR_SUCCESS but length is zero.Sounds unlikely, unless the bucket had length zero. It should only make a difference on streaming bucket types.Is this case, what shall I do with this bucket? shall I read it again with blocking? or pass it and process the next bucket?If you've nothing better to do, then yes. A filter function can also return to its caller if you don't want blocking. |
- blocking vs non-blocking apr_bucket_read() Christina Fu
- Re: blocking vs non-blocking apr_bucket_read() Nick Kew
- Re: blocking vs non-blocking apr_bucket_read() Christina Fu