Mercurial > hg > nginx-vendor-1-0
comparison src/http/ngx_http_upstream.c @ 590:cde3626b2d0d NGINX_0_8_47
nginx 0.8.47
*) Bugfix: $request_time variable had invalid values for subrequests.
*) Bugfix: errors intercepted by error_page could be cached.
*) Bugfix: a cache manager process my got caught in an endless loop, if
max_size parameter was used; the bug had appeared in 0.8.46.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 28 Jul 2010 00:00:00 +0400 |
parents | b6a5942a4e6a |
children | b9763778e212 |
comparison
equal
deleted
inserted
replaced
589:5de4f69bbbab | 590:cde3626b2d0d |
---|---|
1718 *h = *u->headers_in.www_authenticate; | 1718 *h = *u->headers_in.www_authenticate; |
1719 | 1719 |
1720 r->headers_out.www_authenticate = h; | 1720 r->headers_out.www_authenticate = h; |
1721 } | 1721 } |
1722 | 1722 |
1723 #if (NGX_HTTP_CACHE) | |
1724 | |
1725 if (r->cache) { | |
1726 time_t valid; | |
1727 | |
1728 valid = ngx_http_file_cache_valid(u->conf->cache_valid, status); | |
1729 | |
1730 if (valid) { | |
1731 r->cache->valid_sec = ngx_time() + valid; | |
1732 r->cache->error = status; | |
1733 } | |
1734 | |
1735 ngx_http_file_cache_free(r->cache, u->pipe->temp_file); | |
1736 } | |
1737 #endif | |
1723 ngx_http_upstream_finalize_request(r, u, status); | 1738 ngx_http_upstream_finalize_request(r, u, status); |
1724 | 1739 |
1725 return NGX_OK; | 1740 return NGX_OK; |
1726 } | 1741 } |
1727 } | 1742 } |
1931 | 1946 |
1932 size = b->end - b->last; | 1947 size = b->end - b->last; |
1933 | 1948 |
1934 if (size == 0) { | 1949 if (size == 0) { |
1935 ngx_log_error(NGX_LOG_ALERT, c->log, 0, | 1950 ngx_log_error(NGX_LOG_ALERT, c->log, 0, |
1936 "upstream buffer is too small to read repsonse"); | 1951 "upstream buffer is too small to read response"); |
1937 ngx_http_upstream_finalize_request(r, u, NGX_ERROR); | 1952 ngx_http_upstream_finalize_request(r, u, NGX_ERROR); |
1938 return; | 1953 return; |
1939 } | 1954 } |
1940 | 1955 |
1941 n = c->recv(c, b->last, size); | 1956 n = c->recv(c, b->last, size); |
2169 | 2184 |
2170 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | 2185 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, |
2171 "http cacheable: %d", u->cacheable); | 2186 "http cacheable: %d", u->cacheable); |
2172 | 2187 |
2173 if (u->cacheable == 0 && r->cache) { | 2188 if (u->cacheable == 0 && r->cache) { |
2174 ngx_http_file_cache_free(r, u->pipe->temp_file); | 2189 ngx_http_file_cache_free(r->cache, u->pipe->temp_file); |
2175 } | 2190 } |
2176 | 2191 |
2177 #endif | 2192 #endif |
2178 | 2193 |
2179 p = u->pipe; | 2194 p = u->pipe; |
2644 /* TODO: check length & update cache */ | 2659 /* TODO: check length & update cache */ |
2645 | 2660 |
2646 ngx_http_file_cache_update(r, u->pipe->temp_file); | 2661 ngx_http_file_cache_update(r, u->pipe->temp_file); |
2647 | 2662 |
2648 } else if (p->upstream_error) { | 2663 } else if (p->upstream_error) { |
2649 ngx_http_file_cache_free(r, u->pipe->temp_file); | 2664 ngx_http_file_cache_free(r->cache, u->pipe->temp_file); |
2650 } | 2665 } |
2651 } | 2666 } |
2652 | 2667 |
2653 #endif | 2668 #endif |
2654 | 2669 |
2972 #if (NGX_HTTP_CACHE) | 2987 #if (NGX_HTTP_CACHE) |
2973 | 2988 |
2974 if (u->cacheable && r->cache) { | 2989 if (u->cacheable && r->cache) { |
2975 time_t valid; | 2990 time_t valid; |
2976 | 2991 |
2977 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
2978 "http upstream cache fd: %d", | |
2979 r->cache->file.fd); | |
2980 | |
2981 if (rc == NGX_HTTP_BAD_GATEWAY || rc == NGX_HTTP_GATEWAY_TIME_OUT) { | 2992 if (rc == NGX_HTTP_BAD_GATEWAY || rc == NGX_HTTP_GATEWAY_TIME_OUT) { |
2982 | 2993 |
2983 valid = ngx_http_file_cache_valid(u->conf->cache_valid, rc); | 2994 valid = ngx_http_file_cache_valid(u->conf->cache_valid, rc); |
2984 | 2995 |
2985 if (valid) { | 2996 if (valid) { |
2986 r->cache->valid_sec = ngx_time() + valid; | 2997 r->cache->valid_sec = ngx_time() + valid; |
2987 r->cache->error = rc; | 2998 r->cache->error = rc; |
2988 } | 2999 } |
2989 } | 3000 } |
2990 | 3001 |
2991 ngx_http_file_cache_free(r, u->pipe->temp_file); | 3002 ngx_http_file_cache_free(r->cache, u->pipe->temp_file); |
2992 } | 3003 } |
2993 | 3004 |
2994 #endif | 3005 #endif |
2995 | 3006 |
2996 if (u->header_sent | 3007 if (u->header_sent |