Mercurial > hg > nginx-quic
diff src/http/modules/ngx_http_not_modified_filter_module.c @ 2361:c59485781f0a
if_modified_since
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 01 Dec 2008 14:22:51 +0000 |
parents | b67b75bb09b7 |
children | 9081bbdccda1 |
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); }