comparison src/http/ngx_http_file_cache.c @ 558:2da4537168f8 NGINX_0_8_31

nginx 0.8.31 *) Feature: now the "error_page" directive may redirect the 301 and 302 responses. *) Feature: the $geoip_city_continent_code, $geoip_latitude, and $geoip_longitude variables. Thanks to Arvind Sundararajan. *) Feature: now the ngx_http_image_filter_module deletes always EXIF and other application specific data if the data consume more than 5% of a JPEG file. *) Bugfix: nginx closed a connection if a cached response had an empty body. Thanks to Piotr Sikora. *) Bugfix: nginx might not be built by gcc 4.x if the -O2 or higher optimization option was used. Thanks to Maxim Dounin and Denis F. Latypoff. *) Bugfix: regular expressions in location were always tested in case-sensitive mode; the bug had appeared in 0.8.25. *) Bugfix: nginx cached a 304 response if there was the "If-None-Match" header line in a proxied request. Thanks to Tim Dettrick and David Kostal. *) Bugfix: nginx/Windows tried to delete a temporary file twice if the file should replace an already existent file.
author Igor Sysoev <http://sysoev.ru>
date Wed, 23 Dec 2009 00:00:00 +0300
parents 5c576ea5dbd9
children da3c99095432
comparison
equal deleted inserted replaced
557:72104cd120ec 558:2da4537168f8
781 781
782 782
783 ngx_int_t 783 ngx_int_t
784 ngx_http_cache_send(ngx_http_request_t *r) 784 ngx_http_cache_send(ngx_http_request_t *r)
785 { 785 {
786 off_t size;
787 ngx_int_t rc; 786 ngx_int_t rc;
788 ngx_buf_t *b; 787 ngx_buf_t *b;
789 ngx_chain_t out; 788 ngx_chain_t out;
790 ngx_http_cache_t *c; 789 ngx_http_cache_t *c;
791 790
804 b->file = ngx_pcalloc(r->pool, sizeof(ngx_file_t)); 803 b->file = ngx_pcalloc(r->pool, sizeof(ngx_file_t));
805 if (b->file == NULL) { 804 if (b->file == NULL) {
806 return NGX_HTTP_INTERNAL_SERVER_ERROR; 805 return NGX_HTTP_INTERNAL_SERVER_ERROR;
807 } 806 }
808 807
808 r->header_only = (c->length - c->body_start) == 0;
809
809 rc = ngx_http_send_header(r); 810 rc = ngx_http_send_header(r);
810 811
811 if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { 812 if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
812 return rc; 813 return rc;
813 } 814 }
814 815
815 size = c->length - c->body_start;
816 if (size == 0) {
817 return rc;
818 }
819
820 b->file_pos = c->body_start; 816 b->file_pos = c->body_start;
821 b->file_last = c->length; 817 b->file_last = c->length;
822 818
823 b->in_file = size ? 1: 0; 819 b->in_file = 1;
824 b->last_buf = (r == r->main) ? 1: 0; 820 b->last_buf = (r == r->main) ? 1: 0;
825 b->last_in_chain = 1; 821 b->last_in_chain = 1;
826 822
827 b->file->fd = c->file.fd; 823 b->file->fd = c->file.fd;
828 b->file->name = c->file.name; 824 b->file->name = c->file.name;