--- nginx-1.9.7/src/http/ngx_http_upstream.c	2015-11-17 14:50:58.000000000 +0000
+++ nginx-1.9.7-patch/src/http/ngx_http_upstream.c	2015-11-27 15:23:05.262957778 +0000
@@ -3956,6 +3956,12 @@
 
     u->finalize_request(r, rc);
 
+    if (u->writer.out != NULL
+        || (r->request_body && r->request_body->rest > 0))
+    {
+        /*
+         * cannot reuse the upstream connection if the current
+         * request is not completely sent
+         */
+        u->keepalive = 0;
+    }
+
     if (u->peer.free && u->peer.sockaddr) {
         u->peer.free(&u->peer, u->peer.data, 0);
         u->peer.sockaddr = NULL;
