# HG changeset patch # User Igor Sysoev # Date 1182072555 0 # Node ID 05b5236c2ff5b05f35c82eed2e2afe6a8eab2b53 # Parent 5076d97b9cf015d5acdcac2a00aa205acb9416e5 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 diff --git a/src/http/ngx_http_copy_filter_module.c b/src/http/ngx_http_copy_filter_module.c --- a/src/http/ngx_http_copy_filter_module.c +++ b/src/http/ngx_http_copy_filter_module.c @@ -117,6 +117,10 @@ ngx_http_copy_filter(ngx_http_request_t 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); 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 @@ -2157,8 +2157,17 @@ ngx_http_upstream_finalize_request(ngx_h 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);