Mercurial > hg > nginx-vendor-0-7
diff src/http/modules/ngx_http_not_modified_filter_module.c @ 424:9da1d9d94d18 NGINX_0_7_24
nginx 0.7.24
*) Feature: the "if_modified_since" directive.
*) Bugfix: nginx did not process a FastCGI server response, if the
server send too many messages to stderr before response.
*) Bugfix: the "$cookie_..." variables did not work in the SSI and the
perl module.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 01 Dec 2008 00:00:00 +0300 |
parents | 05693816539c |
children | 33394d1255b0 |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_not_modified_filter_module.c +++ b/src/http/modules/ngx_http_not_modified_filter_module.c @@ -50,7 +50,8 @@ static ngx_http_output_header_filter_pt static ngx_int_t ngx_http_not_modified_header_filter(ngx_http_request_t *r) { - time_t ims; + time_t ims; + ngx_http_core_loc_conf_t *clcf; if (r->headers_out.status != NGX_HTTP_OK || r != r->main @@ -66,17 +67,22 @@ ngx_int_t ngx_http_not_modified_header_f ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "http ims:%d lm:%d", ims, r->headers_out.last_modified_time); - /* - * I think that the equality of the dates is correcter - */ + if (ims != r->headers_out.last_modified_time) { + + clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); - if (ims == r->headers_out.last_modified_time) { - r->headers_out.status = NGX_HTTP_NOT_MODIFIED; - r->headers_out.content_type.len = 0; - ngx_http_clear_content_length(r); - ngx_http_clear_accept_ranges(r); + if (clcf->if_modified_since == 0 + || ims < r->headers_out.last_modified_time) + { + return ngx_http_next_header_filter(r); + } } + r->headers_out.status = NGX_HTTP_NOT_MODIFIED; + r->headers_out.content_type.len = 0; + ngx_http_clear_content_length(r); + ngx_http_clear_accept_ranges(r); + return ngx_http_next_header_filter(r); }