diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2009-04-01 15:58:21 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2009-04-01 15:58:21 +0000 |
| commit | c7bd98abaad56d7afff438afb06fe69013a03be2 (patch) | |
| tree | 5a928283bf9b8d8d2ae95ebd2e2062d26363d1f2 /src/http/modules | |
| parent | 2a9aa8fc491206fdad62e685a55db7d68ab3ebb4 (diff) | |
| download | nginx-c7bd98abaad56d7afff438afb06fe69013a03be2.tar.gz nginx-c7bd98abaad56d7afff438afb06fe69013a03be2.tar.bz2 | |
r2362, r2497 merge:
if_modified_since
Diffstat (limited to 'src/http/modules')
| -rw-r--r-- | src/http/modules/ngx_http_not_modified_filter_module.c | 28 |
1 files changed, 19 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..feed9cf54 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 @@ -60,23 +61,32 @@ ngx_int_t ngx_http_not_modified_header_filter(ngx_http_request_t *r) return ngx_http_next_header_filter(r); } + clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); + + if (clcf->if_modified_since == NGX_HTTP_IMS_OFF) { + return ngx_http_next_header_filter(r); + } + ims = ngx_http_parse_time(r->headers_in.if_modified_since->value.data, r->headers_in.if_modified_since->value.len); 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); + if (clcf->if_modified_since == NGX_HTTP_IMS_EXACT + || 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); } |
