<br><br><div class="gmail_quote">On Thu, Sep 8, 2011 at 2:27 AM, 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 Wed, Sep 07, 2011 at 04:33:38PM -0700, Matthieu Tourne wrote:<br>
<br>
> Thanks for the all-included patch from 1.1.2<br>
><br>
> It seems that keepalive connections aren't working in combination with<br>
> proxy_buffering off; (c->read->ready is set to 1)<br>
> It worked before this last update, is this the intended behavior ?<br>
<br>
</div>Linux with epoll, right?  Please try the following patch:<br></blockquote><div><br></div><div>Yes, Linux with epoll.</div><div>The patch below seems to fix the issue. Thank you Maxim!</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">


<br>
diff --git a/src/http/modules/ngx_http_upstream_keepalive_module.c b/src/http/modules/ngx_http_upstream_keepalive_module.c<br>
--- a/src/http/modules/ngx_http_upstream_keepalive_module.c<br>
+++ b/src/http/modules/ngx_http_upstream_keepalive_module.c<br>
@@ -321,7 +321,6 @@ ngx_http_upstream_free_keepalive_peer(ng<br>
     if (kp->failed<br>
         || c == NULL<br>
         || c->read->eof<br>
-        || c->read->ready<br>
         || c->read->error<br>
         || c->read->timedout<br>
         || c->write->error<br>
@@ -382,6 +381,10 @@ ngx_http_upstream_free_keepalive_peer(ng<br>
     item->socklen = pc->socklen;<br>
     ngx_memcpy(&item->sockaddr, pc->sockaddr, pc->socklen);<br>
<br>
+    if (c->read->ready) {<br>
+        ngx_http_upstream_keepalive_close_handler(c->read);<br>
+    }<br>
+<br>
 invalid:<br>
<br>
     kp->original_free_peer(pc, kp->data, state);<br>
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c<br>
--- a/src/http/ngx_http_upstream.c<br>
+++ b/src/http/ngx_http_upstream.c<br>
@@ -2142,7 +2142,7 @@ ngx_http_upstream_send_response(ngx_http<br>
                 return;<br>
             }<br>
<br>
-            if (u->peer.connection->read->ready) {<br>
+            if (u->peer.connection->read->ready || u->length == 0) {<br>
                 ngx_http_upstream_process_non_buffered_upstream(r, u);<br>
             }<br>
         }<br>
<br>
Second part fixes one more problem with handling of responses with<br>
empty body over keepalive connections, found during testing with<br>
various event methods.<br>
<div><div></div><div class="h5"><br>
Maxim Dounin<br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</div></div></blockquote></div><br>