]> git.kaiwu.me - nginx.git/commitdiff
r1260 merge:
authorIgor Sysoev <igor@sysoev.ru>
Thu, 5 Jul 2007 11:42:11 +0000 (11:42 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Thu, 5 Jul 2007 11:42:11 +0000 (11:42 +0000)
if subrequest response was buffered in file, then subrequest was finalized
with 0 code, ngx_http_writer() was not set, and response part in file was lost

src/http/ngx_http_copy_filter_module.c
src/http/ngx_http_upstream.c

index c96dbfa765d476522a725f5b58c614061827af5d..3069779c2eeec00fa046e31547373204e8bdf993 100644 (file)
@@ -117,6 +117,10 @@ ngx_http_copy_filter(ngx_http_request_t *r, ngx_chain_t *in)
             r->buffered |= NGX_HTTP_COPY_BUFFERED;
         }
 
+        if (r != r->main) {
+            r->out = ctx->in;
+        }
+
 #if (NGX_DEBUG)
         ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                        "copy filter: %i \"%V?%V\"", rc, &r->uri, &r->args);
index 392783664c1a109e675332159db0f709e93c9e65..c1bae266c63103b75722bd6dd30e5f51be24d9c1 100644 (file)
@@ -2157,8 +2157,17 @@ ngx_http_upstream_finalize_request(ngx_http_request_t *r,
 
     r->connection->log->action = "sending to client";
 
-    if (rc == 0 && r == r->main && !r->post_action) {
-        rc = ngx_http_send_special(r, NGX_HTTP_LAST);
+    if (rc == 0) {
+        if (r == r->main) {
+            if (!r->post_action) {
+                rc = ngx_http_send_special(r, NGX_HTTP_LAST);
+            }
+
+        } else {
+            if (r->out) {
+                rc = NGX_AGAIN;
+            }
+        }
     }
 
     ngx_http_finalize_request(r, rc);