From 5c5d241e486bfe119216a6c79da4a2c3093aef17 Mon Sep 17 00:00:00 2001 From: Maxim Dounin Date: Tue, 13 Dec 2011 18:46:07 +0000 Subject: [PATCH] Merge of r4217, r4218: Fixed "expires @00h". Fixed "expires @time" with unknown last modified time (ticket #32). --- src/http/modules/ngx_http_headers_filter_module.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/http/modules/ngx_http_headers_filter_module.c b/src/http/modules/ngx_http_headers_filter_module.c index c3f74ae19..c846c5fea 100644 --- a/src/http/modules/ngx_http_headers_filter_module.c +++ b/src/http/modules/ngx_http_headers_filter_module.c @@ -253,7 +253,7 @@ ngx_http_set_expires(ngx_http_request_t *r, ngx_http_headers_conf_t *conf) return NGX_ERROR; } - if (conf->expires_time == 0) { + if (conf->expires_time == 0 && conf->expires != NGX_HTTP_EXPIRES_DAILY) { ngx_memcpy(expires->value.data, ngx_cached_http_time.data, ngx_cached_http_time.len + 1); ngx_str_set(&cc->value, "max-age=0"); @@ -262,16 +262,16 @@ ngx_http_set_expires(ngx_http_request_t *r, ngx_http_headers_conf_t *conf) now = ngx_time(); - if (conf->expires == NGX_HTTP_EXPIRES_ACCESS - || r->headers_out.last_modified_time == -1) + if (conf->expires == NGX_HTTP_EXPIRES_DAILY) { + expires_time = ngx_next_time(conf->expires_time); + max_age = expires_time - now; + + } else if (conf->expires == NGX_HTTP_EXPIRES_ACCESS + || r->headers_out.last_modified_time == -1) { expires_time = now + conf->expires_time; max_age = conf->expires_time; - } else if (conf->expires == NGX_HTTP_EXPIRES_DAILY) { - expires_time = ngx_next_time(conf->expires_time); - max_age = expires_time - now; - } else { expires_time = r->headers_out.last_modified_time + conf->expires_time; max_age = expires_time - now;