i find this result  is cause by postpone filter is removed. because i use --without-http_ssi_module config nginx. and i read nginx config find this   in  auto/modules:<div><br><div><div>if [ $HTTP_SSI = YES ]; then</div><div>

    HTTP_POSTPONE=YES</div><div>fi</div><div><br></div><div><br></div><div>if [ $HTTP_ADDITION = YES ]; then</div><div>    HTTP_POSTPONE=YES</div><div>fi</div><div><br></div><div>and why  postpone is yes when ssi or addition module is on ? </div>

<div>and then i debug nginx find some code in ngx_http_postpone_filter method :</div><div><br></div><div><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></div><div><br></div><div>therefore if no postpone module, sub filter module may emerge the result in my previous email  . </div><br><div class="gmail_quote">

On Wed, Sep 15, 2010 at 11:00 AM, Simon Liu <span dir="ltr">&lt;<a href="mailto:simohayha.bobo@gmail.com">simohayha.bobo@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div>my nginx version is 0.7.67.</div><div><br></div><div>I test nginx&#39;s sub filter, there have some alert log in error log:</div><div><br></div><div><i><span style="background-color:rgb(255, 255, 255)"><font color="#990000">the http output chain is empty while sending response to client.</font></span></i></div>


<div><i><span style="background-color:rgb(255, 255, 255)"><br></span></i></div><div><span style="background-color:rgb(255, 255, 255)">and  i debug nginx , and then found this is cause by sub filter. so  i read  sub filter&#39;s source. </span></div>


<div><br></div>in  ngx_http_sub_body_filter:<div><br></div><div><div>  <i> <span style="background-color:rgb(204, 204, 204)"> <span style="background-color:rgb(255, 255, 255)"><font color="#FF0000">if (ctx-&gt;once &amp;&amp; (ctx-&gt;buf == NULL || ctx-&gt;in == NULL)) {</font></span></span></i></div>


<div><i><span style="background-color:rgb(255, 255, 255)"><font color="#FF0000"><br></font></span></i></div><div><i><span style="background-color:rgb(255, 255, 255)"><font color="#FF0000">        if (ctx-&gt;busy) {</font></span></i></div>


<div><i><span style="background-color:rgb(255, 255, 255)"><font color="#FF0000">            if (ngx_http_sub_output(r, ctx) == NGX_ERROR) {</font></span></i></div><div><i><span style="background-color:rgb(255, 255, 255)"><font color="#FF0000">                return NGX_ERROR;</font></span></i></div>


<div><i><span style="background-color:rgb(255, 255, 255)"><font color="#FF0000">            }</font></span></i></div><div><i><span style="background-color:rgb(255, 255, 255)"><font color="#FF0000">        }</font></span></i></div>


<div><i><span style="background-color:rgb(255, 255, 255)"><font color="#FF0000"><br></font></span></i></div><div><i><span style="background-color:rgb(255, 255, 255)"><font color="#FF0000">        return ngx_http_next_body_filter(r, in);</font></span></i></div>


<div><i><span style="background-color:rgb(255, 255, 255)"><font color="#FF0000">    }</font></span></i></div><div><br></div><div>i found when  <font color="#FF0000">sub_filter_once</font> is on , after  text have replaced . and the second enter ngx_http_sub_body_filter.</div>


<div><span style="line-height:18px">At the moment</span> when <font color="#FF0000">in</font> is null,<font color="#FF0000">ctx-&gt;busy</font> is not null,and so <i><span style="background-color:rgb(255, 255, 255)"><font color="#FF0000">ngx_http_sub_output <span style="font-style:normal"> <font color="#000000">may</font></span></font> send  </span></i><span style="font-family:arial, sans-serif;line-height:15px">the rest of</span><i><span style="background-color:rgb(255, 255, 255)"> buf  <font face="arial, sans-serif"><span style="font-style:normal">completely</span></font></span></i><i><span style="background-color:rgb(255, 255, 255)">,  <span style="font-style:normal;line-height:18px">therefore in </span> </span></i><i><span style="background-color:rgb(255, 255, 255)"><font color="#FF0000">ngx_http_next_body_filter </font>will log alert log : the http output chain is empty while sending response to client. </span></i></div>


<div><i><br></i></div><div><i>i</i><span style="line-height:18px">n conclusion I </span><i>think  there should add a </i><span style="line-height:18px">judgement that<font color="#FF0000"> in</font> is whether or not NULL.</span></div>


<div><i><span style="background-color:rgb(255, 255, 255)"><br></span></i></div><div><i>this is my patch:</i></div><div><i><br></i></div><div><i><div>--- nginx-0.7.67/src/http/modules/ngx_http_sub_filter_module.c<span style="white-space:pre-wrap">        </span>2009-10-26 23:54:29.000000000 +0800</div>


<div>+++ nginx-0.7.67_new/src/http/modules/ngx_http_sub_filter_module.c<span style="white-space:pre-wrap">        </span>2010-09-15 10:14:04.996666685 +0800</div><div>@@ -187,16 +187,16 @@ ngx_http_sub_body_filter(ngx_http_reques</div>


<div>     }</div><div> </div><div>     if (ctx-&gt;once &amp;&amp; (ctx-&gt;buf == NULL || ctx-&gt;in == NULL)) {</div><div> </div><div>         if (ctx-&gt;busy) {</div><div>-            if (ngx_http_sub_output(r, ctx) == NGX_ERROR) {</div>


<div>-                return NGX_ERROR;</div><div>-            }</div><div>+            rc = ngx_http_sub_output(r, ctx);</div><div>         }</div><div> </div><div>-        return ngx_http_next_body_filter(r, in);</div>

<div>
+        if (rc != NGX_ERROR &amp;&amp; in != NULL)</div><div>+            return ngx_http_next_body_filter(r, in);</div><div>+        return rc;</div><div>     }</div><div> </div><div>     /* add the incoming chain to the chain ctx-&gt;in */</div>


<div> </div><div>     if (in) {</div></i></div><div><i><span style="background-color:rgb(255, 255, 255)"><br></span></i></div>-- <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>
</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></div>