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.
This commit is contained in:
Maxim Dounin 2013-09-27 16:50:26 +04:00
parent 1c437d9242
commit 70030dca84
1 changed files with 6 additions and 4 deletions

View File

@ -1711,10 +1711,6 @@ ngx_http_upstream_process_header(ngx_http_request_t *r, ngx_http_upstream_t *u)
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 @@ ngx_http_upstream_finalize_request(ngx_http_request_t *r,
#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;
}