<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; "> &quot;the http output chain is empty while sending response to client.&quot;  </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&#39;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-&gt;postponed == NULL) {</div><div><br></div><div>        if (in || c-&gt;buffered) {</div><div>            return ngx_http_next_filter(r-&gt;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">&lt;<a href="mailto:mdounin@mdounin.ru">mdounin@mdounin.ru</a>&gt;</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>
&gt; i find this result  is cause by postpone filter is removed. because i<br>
&gt; use --without-http_ssi_module config nginx. and i read nginx config find<br>
&gt; this   in  auto/modules:<br>
&gt;<br>
&gt; if [ $HTTP_SSI = YES ]; then<br>
&gt;     HTTP_POSTPONE=YES<br>
&gt; fi<br>
&gt;<br>
&gt;<br>
&gt; if [ $HTTP_ADDITION = YES ]; then<br>
&gt;     HTTP_POSTPONE=YES<br>
&gt; fi<br>
&gt;<br>
&gt; 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&#39;t be needed when no subrequests are used.<br>
<div class="im"><br>
&gt; and then i debug nginx find some code in ngx_http_postpone_filter method :<br>
&gt;<br>
&gt;     if (r-&gt;postponed == NULL) {<br>
&gt;<br>
&gt;         if (in || c-&gt;buffered) {<br>
&gt;             return ngx_http_next_filter(r-&gt;main, in);<br>
&gt;         }<br>
&gt;<br>
&gt;         return NGX_OK;<br>
&gt;     }<br>
&gt;<br>
&gt; therefore if no postpone module, sub filter module may emerge the result in<br>
&gt; my previous email  .<br>
&gt;<br>
&gt; On Wed, Sep 15, 2010 at 11:00 AM, Simon Liu &lt;<a href="mailto:simohayha.bobo@gmail.com">simohayha.bobo@gmail.com</a>&gt;wrote:<br>
&gt;<br>
&gt; &gt; my nginx version is 0.7.67.<br>
&gt; &gt;<br>
&gt; &gt; I test nginx&#39;s sub filter, there have some alert log in error log:<br>
&gt; &gt;<br>
&gt; &gt; *the http output chain is empty while sending response to client.*<br>
&gt; &gt; *<br>
&gt; &gt; *<br>
&gt; &gt; and  i debug nginx , and then found this is cause by sub filter. so  i read<br>
&gt; &gt;  sub filter&#39;s source.<br>
&gt; &gt;<br>
&gt; &gt; in  ngx_http_sub_body_filter:<br>
&gt; &gt;<br>
&gt; &gt;   *  if (ctx-&gt;once &amp;&amp; (ctx-&gt;buf == NULL || ctx-&gt;in == NULL)) {*<br>
&gt; &gt; *<br>
&gt; &gt; *<br>
&gt; &gt; *        if (ctx-&gt;busy) {*<br>
&gt; &gt; *            if (ngx_http_sub_output(r, ctx) == NGX_ERROR) {*<br>
&gt; &gt; *                return NGX_ERROR;*<br>
&gt; &gt; *            }*<br>
&gt; &gt; *        }*<br>
&gt; &gt; *<br>
&gt; &gt; *<br>
&gt; &gt; *        return ngx_http_next_body_filter(r, in);*<br>
&gt; &gt; *    }*<br>
&gt; &gt;<br>
&gt; &gt; i found when  sub_filter_once is on , after  text have replaced . and the<br>
&gt; &gt; second enter ngx_http_sub_body_filter.<br>
&gt; &gt; At the moment when in is null,ctx-&gt;busy is not null,and so *ngx_http_sub_output<br>
&gt; &gt;  may send  *the rest of* buf  completely**,  therefore in  **ngx_http_next_body_filter<br>
&gt; &gt; will log alert log : the http output chain is empty while sending response<br>
</div>&gt; &gt; to client. *<br>
&gt; &gt; *<br>
&gt; &gt; *<br>
&gt; &gt; *i*n conclusion I *think  there should add a *judgement that in is whether<br>
<div class="im">&gt; &gt; or not NULL.<br>
&gt; &gt; *<br>
&gt; &gt; *<br>
&gt; &gt; *this is my patch:*<br>
&gt; &gt; *<br>
&gt; &gt; *<br>
&gt; &gt; *<br>
&gt; &gt; --- nginx-0.7.67/src/http/modules/ngx_http_sub_filter_module.c 2009-10-26<br>
&gt; &gt; 23:54:29.000000000 +0800<br>
&gt; &gt; +++ nginx-0.7.67_new/src/http/modules/ngx_http_sub_filter_module.c 2010-09-15<br>
&gt; &gt; 10:14:04.996666685 +0800<br>
&gt; &gt; @@ -187,16 +187,16 @@ ngx_http_sub_body_filter(ngx_http_reques<br>
&gt; &gt;      }<br>
&gt; &gt;<br>
&gt; &gt;      if (ctx-&gt;once &amp;&amp; (ctx-&gt;buf == NULL || ctx-&gt;in == NULL)) {<br>
&gt; &gt;<br>
&gt; &gt;          if (ctx-&gt;busy) {<br>
&gt; &gt; -            if (ngx_http_sub_output(r, ctx) == NGX_ERROR) {<br>
&gt; &gt; -                return NGX_ERROR;<br>
&gt; &gt; -            }<br>
&gt; &gt; +            rc = ngx_http_sub_output(r, ctx);<br>
&gt; &gt;          }<br>
&gt; &gt;<br>
&gt; &gt; -        return ngx_http_next_body_filter(r, in);<br>
&gt; &gt;  +        if (rc != NGX_ERROR &amp;&amp; in != NULL)<br>
&gt; &gt; +            return ngx_http_next_body_filter(r, in);<br>
&gt; &gt; +        return rc;<br>
<br>
</div>This will use uninitialized rc when no ctx-&gt;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>