diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2008-12-01 14:22:51 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2008-12-01 14:22:51 +0000 |
| commit | 863325fe98fd5fec5ab33c4dda5dd06f65a092ac (patch) | |
| tree | f575358f8f84306710c9885c7305ebe90c7a209c /src/http/modules | |
| parent | 15fbaa66121453ab750170c98fc3322efb746a03 (diff) | |
| download | nginx-863325fe98fd5fec5ab33c4dda5dd06f65a092ac.tar.gz nginx-863325fe98fd5fec5ab33c4dda5dd06f65a092ac.tar.bz2 | |
if_modified_since
Diffstat (limited to 'src/http/modules')
| -rw-r--r-- | src/http/modules/ngx_http_not_modified_filter_module.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/http/modules/ngx_http_not_modified_filter_module.c b/src/http/modules/ngx_http_not_modified_filter_module.c index ce4b55cf5..389a3a93a 100644 --- 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 ngx_http_next_header_filter; 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_filter(ngx_http_request_t *r) 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) { - 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); + clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); + + 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); } |
