# HG changeset patch # User Maxim Dounin # Date 1380286226 -14400 # Node ID f1caf7b8ae1dfd959b7bc0f3c570fed3d47d028e # Parent e65be17e3a3e498b8cab86c54ae5db90b9e41faf Upstream: subrequest_in_memory fix. With previous code only part of u->buffer might be emptied in case of special responses, resulting in partial responses seen by SSI set in case of simple protocols, or spurious errors like "upstream sent invalid chunked response" in case of complex ones. diff -r e65be17e3a3e -r f1caf7b8ae1d src/http/ngx_http_upstream.c --- a/src/http/ngx_http_upstream.c Fri Sep 27 16:50:13 2013 +0400 +++ b/src/http/ngx_http_upstream.c Fri Sep 27 16:50:26 2013 +0400 @@ -1711,10 +1711,6 @@ if (u->headers_in.status_n >= NGX_HTTP_SPECIAL_RESPONSE) { - if (r->subrequest_in_memory) { - u->buffer.last = u->buffer.pos; - } - if (ngx_http_upstream_test_next(r, u) == NGX_OK) { return; } @@ -3464,6 +3460,12 @@ #endif + if (r->subrequest_in_memory + && u->headers_in.status_n >= NGX_HTTP_SPECIAL_RESPONSE) + { + u->buffer.last = u->buffer.pos; + } + if (rc == NGX_DECLINED) { return; }