comparison src/http/ngx_http_file_cache.c @ 638:692f4d4d7f10 NGINX_1_0_9

nginx 1.0.9 *) Change: now the 0x7F-0x1F characters are escaped as \xXX in an access_log. *) Change: now SIGWINCH signal works only in daemon mode. *) Feature: "proxy/fastcgi/scgi/uwsgi_ignore_headers" directives support the following additional values: X-Accel-Limit-Rate, X-Accel-Buffering, X-Accel-Charset. *) Feature: decrease of memory consumption if SSL is used. *) Feature: accept filters are now supported on NetBSD. *) Feature: the "uwsgi_buffering" and "scgi_buffering" directives. Thanks to Peter Smit. *) Bugfix: a segmentation fault occurred on start or while reconfiguration if the "ssl" directive was used at http level and there was no "ssl_certificate" defined. *) Bugfix: some UTF-8 characters were processed incorrectly. Thanks to Alexey Kuts. *) Bugfix: the ngx_http_rewrite_module directives specified at "server" level were executed twice if no matching locations were defined. *) Bugfix: a socket leak might occurred if "aio sendfile" was used. *) Bugfix: connections with fast clients might be closed after send_timeout if file AIO was used. *) Bugfix: in the ngx_http_autoindex_module. *) Bugfix: the module ngx_http_mp4_module did not support seeking on 32-bit platforms. *) Bugfix: non-cacheable responses might be cached if "proxy_cache_bypass" directive was used. Thanks to John Ferlito. *) Bugfix: cached responses with an empty body were returned incorrectly; the bug had appeared in 0.8.31. *) Bugfix: 201 responses of the ngx_http_dav_module were incorrect; the bug had appeared in 0.8.32. *) Bugfix: in the "return" directive. *) Bugfix: the "ssl_verify_client", "ssl_verify_depth", and "ssl_prefer_server_ciphers" directives might work incorrectly if SNI was used.
author Igor Sysoev <http://sysoev.ru>
date Tue, 01 Nov 2011 00:00:00 +0400
parents 65fd8be45530
children ad25218fd14b
comparison
equal deleted inserted replaced
637:ea7441793bba 638:692f4d4d7f10
852 c = r->cache; 852 c = r->cache;
853 853
854 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 854 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
855 "http file cache send: %s", c->file.name.data); 855 "http file cache send: %s", c->file.name.data);
856 856
857 if (r != r->main && c->length - c->body_start == 0) {
858 return ngx_http_send_header(r);
859 }
860
857 /* we need to allocate all before the header would be sent */ 861 /* we need to allocate all before the header would be sent */
858 862
859 b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t)); 863 b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
860 if (b == NULL) { 864 if (b == NULL) {
861 return NGX_HTTP_INTERNAL_SERVER_ERROR; 865 return NGX_HTTP_INTERNAL_SERVER_ERROR;
864 b->file = ngx_pcalloc(r->pool, sizeof(ngx_file_t)); 868 b->file = ngx_pcalloc(r->pool, sizeof(ngx_file_t));
865 if (b->file == NULL) { 869 if (b->file == NULL) {
866 return NGX_HTTP_INTERNAL_SERVER_ERROR; 870 return NGX_HTTP_INTERNAL_SERVER_ERROR;
867 } 871 }
868 872
869 r->header_only = (c->length - c->body_start) == 0;
870
871 rc = ngx_http_send_header(r); 873 rc = ngx_http_send_header(r);
872 874
873 if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { 875 if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
874 return rc; 876 return rc;
875 } 877 }
876 878
877 b->file_pos = c->body_start; 879 b->file_pos = c->body_start;
878 b->file_last = c->length; 880 b->file_last = c->length;
879 881
880 b->in_file = 1; 882 b->in_file = (c->length - c->body_start) ? 1: 0;
881 b->last_buf = (r == r->main) ? 1: 0; 883 b->last_buf = (r == r->main) ? 1: 0;
882 b->last_in_chain = 1; 884 b->last_in_chain = 1;
883 885
884 b->file->fd = c->file.fd; 886 b->file->fd = c->file.fd;
885 b->file->name = c->file.name; 887 b->file->name = c->file.name;