精通
英语
和
开源
,
擅长
开发
与
培训
,
胸怀四海
第一信赖
我把过滤器的添加和初始化代码去掉后,过滤器就不能用了,因为里面都是空的,在这种情况下数据怎么传送到客户端呢?
/* Pass the buckets to the next filter in the filter stack. If the current filter is a handler, we should get NULL passed in instead of the current filter. At that point, we can just call the first filter in
* the stack, or r->output_filters. */
把桶队列传送到下一个过滤器。如果当前的过滤器是一个处理函数,我们应该用NULL来代替现在的过滤器来进行传递。在哪种情况下,我们只能调用栈内的第一个过滤器,或者说是r->output_filter。
AP_DECLARE(apr_status_t) ap_pass_brigade(ap_filter_t *next,
apr_bucket_brigade *bb)
{
if (next) {
apr_bucket *e;
if ((e = APR_BRIGADE_LAST(bb)) && APR_BUCKET_IS_EOS(e) && next->r) {
/* This is only safe because HTTP_HEADER filter is always in the filter stack.This ensures that there is ALWAYS a request-based filter that we can attach this to. If the HTTP_FILTER is removed, and another filter is not put in its place, then handlers like mod_cgi, which attach their own
EOS bucket to the brigade will be broken, because we will get two EOS buckets on the same request.
因为HTTP_HEADER过滤器永远在过滤器栈内,这就保证了基本的安全性。这保证了总是会有一个基于请求的过滤器能够和本项处理进行配合。如果HTTP_FILTER被删除了,且另外过滤器没有内置到链表内,那么象mod_cgi这类处理函数在附加了它们自己的EOS桶后,队列就会中断,因为我们会对一个请求得到两个EOS桶。
*/
next->r->eos_sent = 1;
/* remember the eos for internal redirects, too */
if (next->r->prev) {
request_rec *prev = next->r->prev;
while (prev) {
prev->eos_sent = 1;
prev = prev->prev;
}
}
}
return next->frec->filter_func.out_func(next, bb);
}
return AP_NOBODY_WROTE;
}
这个又回到了注册过滤器时的过滤器函数上了