<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">thanks <span class="Apple-style-span" style="white-space: nowrap; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; ">Maxim</span>!</span></div>
<div><br></div>my patch is mistake. <div><br></div><div>but when remove http_ssi_module , sub filter module may log alert:</div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; color: rgb(80, 0, 80); "><br>
</span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "> "the http output chain is empty while sending response to client." </span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">because sub filter module need </span><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">ngx_http_postpone_filter's code :</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><div>
if (r->postponed == NULL) {</div><div><br></div><div> if (in || c->buffered) {</div><div> return ngx_http_next_filter(r->main, in);</div><div> }</div><div><br></div><div> return NGX_OK;</div>
<div> }</div></span></div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><br>
</span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">this code is needed by subrequest only? i think sub filter is needed too.</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><div><br></div></span></div><div><br><div class="gmail_quote">On Tue, Sep 21, 2010 at 7:57 PM, Maxim Dounin <span dir="ltr"><<a href="mailto:mdounin@mdounin.ru">mdounin@mdounin.ru</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hello!<br>
<div class="im"><br>
On Tue, Sep 21, 2010 at 05:08:08PM +0800, Simon Liu wrote:<br>
<br>
> i find this result is cause by postpone filter is removed. because i<br>
> use --without-http_ssi_module config nginx. and i read nginx config find<br>
> this in auto/modules:<br>
><br>
> if [ $HTTP_SSI = YES ]; then<br>
> HTTP_POSTPONE=YES<br>
> fi<br>
><br>
><br>
> if [ $HTTP_ADDITION = YES ]; then<br>
> HTTP_POSTPONE=YES<br>
> fi<br>
><br>
> and why postpone is yes when ssi or addition module is on ?<br>
<br>
</div>Postpone filter is used to order data sent by subrequests. It<br>
shouldn't be needed when no subrequests are used.<br>
<div class="im"><br>
> and then i debug nginx find some code in ngx_http_postpone_filter method :<br>
><br>
> if (r->postponed == NULL) {<br>
><br>
> if (in || c->buffered) {<br>
> return ngx_http_next_filter(r->main, in);<br>
> }<br>
><br>
> return NGX_OK;<br>
> }<br>
><br>
> therefore if no postpone module, sub filter module may emerge the result in<br>
> my previous email .<br>
><br>
> On Wed, Sep 15, 2010 at 11:00 AM, Simon Liu <<a href="mailto:simohayha.bobo@gmail.com">simohayha.bobo@gmail.com</a>>wrote:<br>
><br>
> > my nginx version is 0.7.67.<br>
> ><br>
> > I test nginx's sub filter, there have some alert log in error log:<br>
> ><br>
> > *the http output chain is empty while sending response to client.*<br>
> > *<br>
> > *<br>
> > and i debug nginx , and then found this is cause by sub filter. so i read<br>
> > sub filter's source.<br>
> ><br>
> > in ngx_http_sub_body_filter:<br>
> ><br>
> > * if (ctx->once && (ctx->buf == NULL || ctx->in == NULL)) {*<br>
> > *<br>
> > *<br>
> > * if (ctx->busy) {*<br>
> > * if (ngx_http_sub_output(r, ctx) == NGX_ERROR) {*<br>
> > * return NGX_ERROR;*<br>
> > * }*<br>
> > * }*<br>
> > *<br>
> > *<br>
> > * return ngx_http_next_body_filter(r, in);*<br>
> > * }*<br>
> ><br>
> > i found when sub_filter_once is on , after text have replaced . and the<br>
> > second enter ngx_http_sub_body_filter.<br>
> > At the moment when in is null,ctx->busy is not null,and so *ngx_http_sub_output<br>
> > may send *the rest of* buf completely**, therefore in **ngx_http_next_body_filter<br>
> > will log alert log : the http output chain is empty while sending response<br>
</div>> > to client. *<br>
> > *<br>
> > *<br>
> > *i*n conclusion I *think there should add a *judgement that in is whether<br>
<div class="im">> > or not NULL.<br>
> > *<br>
> > *<br>
> > *this is my patch:*<br>
> > *<br>
> > *<br>
> > *<br>
> > --- nginx-0.7.67/src/http/modules/ngx_http_sub_filter_module.c 2009-10-26<br>
> > 23:54:29.000000000 +0800<br>
> > +++ nginx-0.7.67_new/src/http/modules/ngx_http_sub_filter_module.c 2010-09-15<br>
> > 10:14:04.996666685 +0800<br>
> > @@ -187,16 +187,16 @@ ngx_http_sub_body_filter(ngx_http_reques<br>
> > }<br>
> ><br>
> > if (ctx->once && (ctx->buf == NULL || ctx->in == NULL)) {<br>
> ><br>
> > if (ctx->busy) {<br>
> > - if (ngx_http_sub_output(r, ctx) == NGX_ERROR) {<br>
> > - return NGX_ERROR;<br>
> > - }<br>
> > + rc = ngx_http_sub_output(r, ctx);<br>
> > }<br>
> ><br>
> > - return ngx_http_next_body_filter(r, in);<br>
> > + if (rc != NGX_ERROR && in != NULL)<br>
> > + return ngx_http_next_body_filter(r, in);<br>
> > + return rc;<br>
<br>
</div>This will use uninitialized rc when no ctx->busy.<br>
<br>
Maxim Dounin<br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://nginx.org/mailman/listinfo/nginx" target="_blank">http://nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>博观约取<br><br>豆瓣:<a href="http://www.douban.com/people/mustang/" target="_blank">www.douban.com/people/mustang/</a><br><br>blog: <a href="http://www.pagefault.info" target="_blank">www.pagefault.info</a><br>
<br>twitter: <a href="http://www.twitter.com/minibobo" target="_blank">www.twitter.com/minibobo</a><br>
</div>