[PATCH 2 of 2] Cache: fix sending of stale responses

Maxim Dounin mdounin at mdounin.ru
Fri Jan 15 21:16:28 MSK 2010


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1263576722 -10800
# Node ID 41ddd768a2271c217f40cc2802101a3a8c8de90b
# Parent  065ce686b20763357a61f52f6e4a2e07351fee6b
Cache: fix sending of stale responses.

For stale responses two last buffers were sent, resulting in duplicate
final chunk if chunked encoding was used.

diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -2950,7 +2950,12 @@ ngx_http_upstream_finalize_request(ngx_h
 
     r->connection->log->action = "sending to client";
 
-    if (rc == 0) {
+    if (rc == 0
+#if (NGX_HTTP_CACHE)
+        && !r->cached
+#endif
+       )
+    {
         rc = ngx_http_send_special(r, NGX_HTTP_LAST);
     }
 



More information about the nginx-devel mailing list