comparison src/http/ngx_http_file_cache.c @ 3136:47b7b6ac433e

do not pass buf with empty cached response, this fixes "zero size buf in output" alert
author Igor Sysoev <igor@sysoev.ru>
date Tue, 15 Sep 2009 15:12:03 +0000
parents 6060225e9261
children 975f0558aab3
comparison
equal deleted inserted replaced
3135:784126370092 3136:47b7b6ac433e
765 765
766 766
767 ngx_int_t 767 ngx_int_t
768 ngx_http_cache_send(ngx_http_request_t *r) 768 ngx_http_cache_send(ngx_http_request_t *r)
769 { 769 {
770 off_t size;
770 ngx_int_t rc; 771 ngx_int_t rc;
771 ngx_buf_t *b; 772 ngx_buf_t *b;
772 ngx_chain_t out; 773 ngx_chain_t out;
773 ngx_http_cache_t *c; 774 ngx_http_cache_t *c;
774 775
793 794
794 if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { 795 if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
795 return rc; 796 return rc;
796 } 797 }
797 798
799 size = c->length - c->body_start;
800 if (size == 0) {
801 return rc;
802 }
803
798 b->file_pos = c->body_start; 804 b->file_pos = c->body_start;
799 b->file_last = c->length; 805 b->file_last = c->length;
800 806
801 b->in_file = (c->length - c->body_start) ? 1: 0; 807 b->in_file = size ? 1: 0;
802 b->last_buf = (r == r->main) ? 1: 0; 808 b->last_buf = (r == r->main) ? 1: 0;
803 b->last_in_chain = 1; 809 b->last_in_chain = 1;
804 810
805 b->file->fd = c->file.fd; 811 b->file->fd = c->file.fd;
806 b->file->name = c->file.name; 812 b->file->name = c->file.name;