Merge of r4217, r4218:
Fixed "expires @00h". Fixed "expires @time" with unknown last modified
time (ticket #32).
Maxim Dounin
10 years ago
252 | 252 | return NGX_ERROR; |
253 | 253 | } |
254 | 254 | |
255 | if (conf->expires_time == 0) { | |
255 | if (conf->expires_time == 0 && conf->expires != NGX_HTTP_EXPIRES_DAILY) { | |
256 | 256 | ngx_memcpy(expires->value.data, ngx_cached_http_time.data, |
257 | 257 | ngx_cached_http_time.len + 1); |
258 | 258 | ngx_str_set(&cc->value, "max-age=0"); |
261 | 261 | |
262 | 262 | now = ngx_time(); |
263 | 263 | |
264 | if (conf->expires == NGX_HTTP_EXPIRES_ACCESS | |
265 | || r->headers_out.last_modified_time == -1) | |
264 | if (conf->expires == NGX_HTTP_EXPIRES_DAILY) { | |
265 | expires_time = ngx_next_time(conf->expires_time); | |
266 | max_age = expires_time - now; | |
267 | ||
268 | } else if (conf->expires == NGX_HTTP_EXPIRES_ACCESS | |
269 | || r->headers_out.last_modified_time == -1) | |
266 | 270 | { |
267 | 271 | expires_time = now + conf->expires_time; |
268 | 272 | max_age = conf->expires_time; |
269 | ||
270 | } else if (conf->expires == NGX_HTTP_EXPIRES_DAILY) { | |
271 | expires_time = ngx_next_time(conf->expires_time); | |
272 | max_age = expires_time - now; | |
273 | 273 | |
274 | 274 | } else { |
275 | 275 | expires_time = r->headers_out.last_modified_time + conf->expires_time; |