<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><div><br>That was the problem, the content was zipped, everything is working now. <br><br>Thanks,<br>-M<br></div><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"><br><div style="font-family: arial,helvetica,sans-serif; font-size: 13px;"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Igor Sysoev &lt;is@rambler-co.ru&gt;<br><b><span style="font-weight: bold;">To:</span></b> nginx@sysoev.ru<br><b><span style="font-weight: bold;">Sent:</span></b> Wednesday, January 28, 2009 1:39:50 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: question about addition filter<br></font><br>
On Wed, Jan 28, 2009 at 01:28:50PM -0800, Mohammad Kolahdouzan wrote:<br><br>&gt; <br>&gt; Igor,<br>&gt; <br>&gt; I tried your config, with 0.7.32 and 0.7.31, with/without debug, with/without optimization, but I constantly get garbage before and after the content of /y/index.html. Maybe it is returning some uninitialized memory? <br>&gt; <br>&gt; I might be totally wrong, but Evan's module development tutorial mentions something about NGX_AGAIN and that we should return NGX_AGAIN if ngx_http_subrequest returns NGX_AGAIN. But looking in to your code, ngx_http_addition_filter_module.c, line numbers 154 and 183, you are always returning NGX_ERROR if ngx_http_subrequest does not return NGX_OK. Could that be the reason?<br>&gt; <br>&gt; Thanks,<br>&gt; -M<br>&gt; <br>&gt; ps, I doubt it matters, but I have CentOS 5.2 64 bit.<br><br>This may be gzipped content returned by external sites:<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; location = /x {<br>&nbsp;
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; proxy_pass <a href="http://www.yahoo.com/;" target="_blank">http://www.yahoo.com/;</a><br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  proxy_set_header&nbsp; Accept-Encoding&nbsp; "";<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br> <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; location = /g{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; proxy_pass&nbsp; <a href="http://www.google.com/;" target="_blank">http://www.google.com/;</a><br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  proxy_set_header&nbsp; Accept-Encoding&nbsp; "";<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br> <br>&gt; <br>&gt; <br>&gt; <br>&gt; ________________________________<br>&gt; From: Igor Sysoev &lt;<a ymailto="mailto:is@rambler-co.ru" href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>&gt;<br>&gt; To: <a ymailto="mailto:nginx@sysoev.ru" href="mailto:nginx@sysoev.ru">nginx@sysoev.ru</a><br>&gt; Sent: Wednesday, January 28, 2009 12:04:35 PM<br>&gt;
 Subject: Re: question about addition filter<br>&gt; <br>&gt; On Wed, Jan 28, 2009 at 11:21:35AM -0800, Mohammad Kolahdouzan wrote:<br>&gt; <br>&gt; &gt; Is it possible to have a configuration similar to the following:<br>&gt; &gt; <br>&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp;  location /x {<br>&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  proxy_pass <a href="http://www.yahoo.com;" target="_blank">http://www.yahoo.com;</a><br>&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp;  }<br>&gt; &gt; <br>&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp;  location /y {<br>&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  add_before_body /x;<br>&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  add_after_body&nbsp; <a href="http://www.google.com;" target="_blank">http://www.google.com;</a><br>&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp;  }<br>&gt; &gt; <br>&gt; &gt; which would supposedly add the content of the <a target="_blank" href="http://www.yahoo.com">www.yahoo.com</a> and <a
 target="_blank" href="http://www.google.com">www.google.com</a> before and after the content of the page at /y/index.html? The addition filter module states that the texts after add_before_body and add_after_body are URI, but the above config doesn't seem to be doing it!<br>&gt; <br>&gt; This should work, but it's better to use 0.7.32 for this:<br>&gt; <br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; location = /x {<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; proxy_pass <a href="http://www.yahoo.com/;" target="_blank">http://www.yahoo.com/;</a><br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>&gt; <br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; location = /g{<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; proxy_pass&nbsp; <a href="http://www.google.com/;" target="_blank">http://www.google.com/;</a><br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>&gt; <br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; location /y {<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp;
 &nbsp; &nbsp; &nbsp; add_before_body /x;<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add_after_body&nbsp; /q;<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>&gt; <br>&gt; <br>&gt; -- <br>&gt; Igor Sysoev<br>&gt; <a href="http://sysoev.ru/en/" target="_blank">http://sysoev.ru/en/</a><br>&gt; <br>&gt; <br>&gt;&nbsp; &nbsp; &nbsp;  <br><br>-- <br>Igor Sysoev<br><a href="http://sysoev.ru/en/" target="_blank">http://sysoev.ru/en/</a><br><br></div></div></div><br>

      </body></html>