You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jim Carlson <jc...@jnous.com> on 2003/03/14 09:50:29 UTC
ap_get_brigade question
Howdy,
I have a question in the same vein as my last post. Can I rely on
ap_get_brigade(mode=AP_MODE_READBYTES, len=X) to return a brigade of length no
greater than X? It would appear not, which means I need to be prepared to set
aside extra bytes... But I thought this was exactly what the supplying filter
was supposed to do! Confirmation requested.
Thanks!
Jim
Re: ap_get_brigade question
Posted by Jim Carlson <jc...@jnous.com>.
Thanks. I noticed that my perception of a problem was wrong -- I was calling
ap_rgetline multiple times with the same brigade, without calling
apr_brigade_cleanup in between (or something like that). Bytes were left over
from the previous request when the second one returned.
Jim
Greg Stein wrote:
> On Tue, Mar 18, 2003 at 04:45:09PM -0800, Justin Erenkrantz wrote:
>
>>--On Friday, March 14, 2003 12:50 AM -0800 Jim Carlson <jc...@jnous.com>
>>wrote:
>>
>>
>>>Howdy,
>>> I have a question in the same vein as my last post. Can I rely on
>>>ap_get_brigade(mode=AP_MODE_READBYTES, len=X) to return a brigade of length
>>>no greater than X? It would appear not, which means I need to be prepared
>>>to set aside extra bytes... But I thought this was exactly what the
>>>supplying filter was supposed to do! Confirmation requested.
>>
>>A filter could hypothetically ignore AP_MODE_READBYTES's len parameter and
>>return more. But, none of the current filters in our core do this - they will
>>return at most X bytes. I believe we take the position if a filter returns
>>more than X in this case, it is broken. So, it should be a good assumption to
>>make. -- justin
>
>
> Yes, it would be considered broken. The higher-level filter knows the
> boundaries, and how much to ask for (or not). The lower-level filters do not
> and cannot have the knowledge that the higher/application filters have.
>
> Thus, the rule is that a filter never returns more than asked.
>
> [ there are ways to change that, but it isn't in the architecture now ]
>
> Cheers,
> -g
>
Re: ap_get_brigade question
Posted by Greg Stein <gs...@lyra.org>.
On Tue, Mar 18, 2003 at 04:45:09PM -0800, Justin Erenkrantz wrote:
> --On Friday, March 14, 2003 12:50 AM -0800 Jim Carlson <jc...@jnous.com>
> wrote:
>
> > Howdy,
> > I have a question in the same vein as my last post. Can I rely on
> > ap_get_brigade(mode=AP_MODE_READBYTES, len=X) to return a brigade of length
> > no greater than X? It would appear not, which means I need to be prepared
> > to set aside extra bytes... But I thought this was exactly what the
> > supplying filter was supposed to do! Confirmation requested.
>
> A filter could hypothetically ignore AP_MODE_READBYTES's len parameter and
> return more. But, none of the current filters in our core do this - they will
> return at most X bytes. I believe we take the position if a filter returns
> more than X in this case, it is broken. So, it should be a good assumption to
> make. -- justin
Yes, it would be considered broken. The higher-level filter knows the
boundaries, and how much to ask for (or not). The lower-level filters do not
and cannot have the knowledge that the higher/application filters have.
Thus, the rule is that a filter never returns more than asked.
[ there are ways to change that, but it isn't in the architecture now ]
Cheers,
-g
--
Greg Stein, http://www.lyra.org/
Re: ap_get_brigade question
Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
--On Friday, March 14, 2003 12:50 AM -0800 Jim Carlson <jc...@jnous.com>
wrote:
> Howdy,
> I have a question in the same vein as my last post. Can I rely on
> ap_get_brigade(mode=AP_MODE_READBYTES, len=X) to return a brigade of length
> no greater than X? It would appear not, which means I need to be prepared
> to set aside extra bytes... But I thought this was exactly what the
> supplying filter was supposed to do! Confirmation requested.
A filter could hypothetically ignore AP_MODE_READBYTES's len parameter and
return more. But, none of the current filters in our core do this - they will
return at most X bytes. I believe we take the position if a filter returns
more than X in this case, it is broken. So, it should be a good assumption to
make. -- justin