From 95a5ecb1ac78b14b759ada666b2114783fc1c2d2 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Mon, 1 Feb 2010 15:46:14 +0000 Subject: merge r3137, r3198, r3199, r3353, r3370, r3371, r3398, r3399: cache related fixes: *) do not pass buf with empty cached response, this fixes "zero size buf in output" alert *) hide cacheable Set-Cookie and P3P FastCGI response headers *) test comma separator in "Cache-Control" *) a cache manager thread handle was overwritten by a cache loader thread handle, this caused an exit delay, the bug had been introduced in r3248 *) fix handling cached HTTP/0.9 response *) log proxied HTTP/0.9 responses status as "009" *) fix the "If-None-Match" header name *) fix a cached zero-length body case --- src/http/ngx_http_file_cache.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/http/ngx_http_file_cache.c') diff --git a/src/http/ngx_http_file_cache.c b/src/http/ngx_http_file_cache.c index a60483d59..c02bc7740 100644 --- a/src/http/ngx_http_file_cache.c +++ b/src/http/ngx_http_file_cache.c @@ -311,7 +311,7 @@ ngx_http_file_cache_open(ngx_http_request_t *r) return n; } - if ((size_t) n <= c->header_start) { + if ((size_t) n < c->header_start) { ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0, "cache file \"%s\" is too small", c->file.name.data); return NGX_ERROR; @@ -718,6 +718,8 @@ ngx_http_cache_send(ngx_http_request_t *r) return NGX_HTTP_INTERNAL_SERVER_ERROR; } + r->header_only = (c->length - c->body_start) == 0; + rc = ngx_http_send_header(r); if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { @@ -727,7 +729,7 @@ ngx_http_cache_send(ngx_http_request_t *r) b->file_pos = c->body_start; b->file_last = c->length; - b->in_file = (c->length - c->body_start) ? 1: 0; + b->in_file = 1; b->last_buf = (r == r->main) ? 1: 0; b->last_in_chain = 1; -- cgit