comparison src/http/ngx_http_upstream.c @ 5392:f1caf7b8ae1d

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 27 Sep 2013 16:50:26 +0400
parents 46bdbca10dfc
children 16b68c724438
comparison
equal deleted inserted replaced
5391:e65be17e3a3e 5392:f1caf7b8ae1d
1709 1709
1710 /* rc == NGX_OK */ 1710 /* rc == NGX_OK */
1711 1711
1712 if (u->headers_in.status_n >= NGX_HTTP_SPECIAL_RESPONSE) { 1712 if (u->headers_in.status_n >= NGX_HTTP_SPECIAL_RESPONSE) {
1713 1713
1714 if (r->subrequest_in_memory) {
1715 u->buffer.last = u->buffer.pos;
1716 }
1717
1718 if (ngx_http_upstream_test_next(r, u) == NGX_OK) { 1714 if (ngx_http_upstream_test_next(r, u) == NGX_OK) {
1719 return; 1715 return;
1720 } 1716 }
1721 1717
1722 if (ngx_http_upstream_intercept_errors(r, u) == NGX_OK) { 1718 if (ngx_http_upstream_intercept_errors(r, u) == NGX_OK) {
3462 ngx_http_file_cache_free(r->cache, u->pipe->temp_file); 3458 ngx_http_file_cache_free(r->cache, u->pipe->temp_file);
3463 } 3459 }
3464 3460
3465 #endif 3461 #endif
3466 3462
3463 if (r->subrequest_in_memory
3464 && u->headers_in.status_n >= NGX_HTTP_SPECIAL_RESPONSE)
3465 {
3466 u->buffer.last = u->buffer.pos;
3467 }
3468
3467 if (rc == NGX_DECLINED) { 3469 if (rc == NGX_DECLINED) {
3468 return; 3470 return;
3469 } 3471 }
3470 3472
3471 r->connection->log->action = "sending to client"; 3473 r->connection->log->action = "sending to client";