aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_file_cache.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2009-12-23 14:46:45 +0000
committerIgor Sysoev <igor@sysoev.ru>2009-12-23 14:46:45 +0000
commit3662f36a542c9b3ccc7935befc88ec0a063740d5 (patch)
treebc82b92db1523959ee7d341dd9c7463700c1b03e /src/http/ngx_http_file_cache.c
parentbd375b95662382d270567414d7c5a29987fa1c3f (diff)
downloadnginx-3662f36a542c9b3ccc7935befc88ec0a063740d5.tar.gz
nginx-3662f36a542c9b3ccc7935befc88ec0a063740d5.zip
fix a cached zero-length body case
Diffstat (limited to 'src/http/ngx_http_file_cache.c')
-rw-r--r--src/http/ngx_http_file_cache.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/http/ngx_http_file_cache.c b/src/http/ngx_http_file_cache.c
index 4290c9f86..fd605276a 100644
--- a/src/http/ngx_http_file_cache.c
+++ b/src/http/ngx_http_file_cache.c
@@ -783,7 +783,6 @@ ngx_http_file_cache_update(ngx_http_request_t *r, ngx_temp_file_t *tf)
ngx_int_t
ngx_http_cache_send(ngx_http_request_t *r)
{
- off_t size;
ngx_int_t rc;
ngx_buf_t *b;
ngx_chain_t out;
@@ -806,21 +805,18 @@ 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) {
return rc;
}
- size = c->length - c->body_start;
- if (size == 0) {
- return rc;
- }
-
b->file_pos = c->body_start;
b->file_last = c->length;
- b->in_file = size ? 1: 0;
+ b->in_file = 1;
b->last_buf = (r == r->main) ? 1: 0;
b->last_in_chain = 1;