you "pull" (ap_get_brigade) from the input filters and "push"
(ap_pass_brigade) to the output filters.
So yes, at first the "next" in the context of input filters may seem a
little backwards as you start with the last filter and pull from what
you may visualize as the "previous" filter.
Tom
Brandon Fosdick wrote:
Nick Kew wrote:
http://www.apachetutor.org/dev/brigades
Thanks. What book are you referring to?
apr_bucket_brigade *bb;
bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
rc = ap_get_brigade(r->input_filters, bb, AP_MODE_READBYTES,
APR_BLOCK_READ, DAV_READ_BLOCKSIZE);
That's standard for the input chain. ap_get_brigade just populates
the brigade that was just created.
ah, it creates an empty brigade and then fills it with the request
body...that makes more sense.
By "populate", do you mean that it's making a copy of the bits?
I found ap_get_brigade in util_filter.h, and it says that it gets "the
current bucket brigade from the next filter on the filter stack".
Intuitively (for me), "next filter" refers to a filter that has yet to
be called, so how does it already have the brigade when the "current
filter" doesn't? And then, right below that, is ap_pass_brigade, which
passes the brigade to the "next filter". I don't see anything about
previous filters. Am I looking at typos or am I missing something?