# HG changeset patch # User Igor Sysoev # Date 1241543913 0 # Node ID 60551422e1502b37b8632c668f8944aa9c219cfe # Parent edc0cd9db5cfe0ed7da7f4555b0d11cbf84d34ba reinit proxy/fastcgi header parser before ngx_http_upstream_cache_send() 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 @@ -1472,6 +1472,7 @@ ngx_http_upstream_process_header(ngx_htt static ngx_int_t ngx_http_upstream_test_next(ngx_http_request_t *r, ngx_http_upstream_t *u) { + ngx_int_t rc; ngx_uint_t status; ngx_http_upstream_next_t *un; @@ -1491,8 +1492,14 @@ ngx_http_upstream_test_next(ngx_http_req #if (NGX_HTTP_CACHE) if (u->stale_cache && (u->conf->cache_use_stale & un->mask)) { - ngx_http_upstream_finalize_request(r, u, - ngx_http_upstream_cache_send(r, u)); + + rc = u->reinit_request(r); + + if (rc == NGX_OK) { + rc = ngx_http_upstream_cache_send(r, u); + } + + ngx_http_upstream_finalize_request(r, u, rc); return NGX_OK; } @@ -2643,9 +2650,15 @@ ngx_http_upstream_next(ngx_http_request_ #if (NGX_HTTP_CACHE) if (u->stale_cache && (u->conf->cache_use_stale & ft_type)) { - - ngx_http_upstream_finalize_request(r, u, - ngx_http_upstream_cache_send(r, u)); + ngx_int_t rc; + + rc = u->reinit_request(r); + + if (rc == NGX_OK) { + rc = ngx_http_upstream_cache_send(r, u); + } + + ngx_http_upstream_finalize_request(r, u, rc); return; } #endif