comparison src/http/ngx_http_file_cache.c @ 3439:3354dfba9da4 stable-0.7

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
author Igor Sysoev <igor@sysoev.ru>
date Mon, 01 Feb 2010 15:46:14 +0000
parents 8c76116820f3
children e1409e56ba7c
comparison
equal deleted inserted replaced
3438:a0a131127626 3439:3354dfba9da4
309 309
310 if (n == NGX_ERROR) { 310 if (n == NGX_ERROR) {
311 return n; 311 return n;
312 } 312 }
313 313
314 if ((size_t) n <= c->header_start) { 314 if ((size_t) n < c->header_start) {
315 ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0, 315 ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0,
316 "cache file \"%s\" is too small", c->file.name.data); 316 "cache file \"%s\" is too small", c->file.name.data);
317 return NGX_ERROR; 317 return NGX_ERROR;
318 } 318 }
319 319
716 b->file = ngx_pcalloc(r->pool, sizeof(ngx_file_t)); 716 b->file = ngx_pcalloc(r->pool, sizeof(ngx_file_t));
717 if (b->file == NULL) { 717 if (b->file == NULL) {
718 return NGX_HTTP_INTERNAL_SERVER_ERROR; 718 return NGX_HTTP_INTERNAL_SERVER_ERROR;
719 } 719 }
720 720
721 r->header_only = (c->length - c->body_start) == 0;
722
721 rc = ngx_http_send_header(r); 723 rc = ngx_http_send_header(r);
722 724
723 if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { 725 if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
724 return rc; 726 return rc;
725 } 727 }
726 728
727 b->file_pos = c->body_start; 729 b->file_pos = c->body_start;
728 b->file_last = c->length; 730 b->file_last = c->length;
729 731
730 b->in_file = (c->length - c->body_start) ? 1: 0; 732 b->in_file = 1;
731 b->last_buf = (r == r->main) ? 1: 0; 733 b->last_buf = (r == r->main) ? 1: 0;
732 b->last_in_chain = 1; 734 b->last_in_chain = 1;
733 735
734 b->file->fd = c->file.fd; 736 b->file->fd = c->file.fd;
735 b->file->name = c->file.name; 737 b->file->name = c->file.name;