| 1 | # HG changeset patch
|
|---|
| 2 | # User Maxim Dounin <mdounin@mdounin.ru>
|
|---|
| 3 | # Date 1318717745 -14400
|
|---|
| 4 | # Node ID 18b6098a21c7de4e5a1ebf59730774a464a84d66
|
|---|
| 5 | # Parent 5d45cbf2668ace0ce1f8d15e5f598040e8b79067
|
|---|
| 6 | Fixes for expires daily (ticket #32).
|
|---|
| 7 |
|
|---|
| 8 | If last modified time wasn't known, "expires @time" did not work.
|
|---|
| 9 | Additionally, in all cases "expires @00h" did not work.
|
|---|
| 10 |
|
|---|
| 11 | diff --git a/src/http/modules/ngx_http_headers_filter_module.c b/src/http/modules/ngx_http_headers_filter_module.c
|
|---|
| 12 | --- a/src/http/modules/ngx_http_headers_filter_module.c
|
|---|
| 13 | +++ b/src/http/modules/ngx_http_headers_filter_module.c
|
|---|
| 14 | @@ -253,7 +253,7 @@ ngx_http_set_expires(ngx_http_request_t
|
|---|
| 15 | return NGX_ERROR;
|
|---|
| 16 | }
|
|---|
| 17 |
|
|---|
| 18 | - if (conf->expires_time == 0) {
|
|---|
| 19 | + if (conf->expires_time == 0 && conf->expires != NGX_HTTP_EXPIRES_DAILY) {
|
|---|
| 20 | ngx_memcpy(expires->value.data, ngx_cached_http_time.data,
|
|---|
| 21 | ngx_cached_http_time.len + 1);
|
|---|
| 22 | ngx_str_set(&cc->value, "max-age=0");
|
|---|
| 23 | @@ -262,16 +262,16 @@ ngx_http_set_expires(ngx_http_request_t
|
|---|
| 24 |
|
|---|
| 25 | now = ngx_time();
|
|---|
| 26 |
|
|---|
| 27 | - if (conf->expires == NGX_HTTP_EXPIRES_ACCESS
|
|---|
| 28 | - || r->headers_out.last_modified_time == -1)
|
|---|
| 29 | + if (conf->expires == NGX_HTTP_EXPIRES_DAILY) {
|
|---|
| 30 | + expires_time = ngx_next_time(conf->expires_time);
|
|---|
| 31 | + max_age = expires_time - now;
|
|---|
| 32 | +
|
|---|
| 33 | + } else if (conf->expires == NGX_HTTP_EXPIRES_ACCESS
|
|---|
| 34 | + || r->headers_out.last_modified_time == -1)
|
|---|
| 35 | {
|
|---|
| 36 | expires_time = now + conf->expires_time;
|
|---|
| 37 | max_age = conf->expires_time;
|
|---|
| 38 |
|
|---|
| 39 | - } else if (conf->expires == NGX_HTTP_EXPIRES_DAILY) {
|
|---|
| 40 | - expires_time = ngx_next_time(conf->expires_time);
|
|---|
| 41 | - max_age = expires_time - now;
|
|---|
| 42 | -
|
|---|
| 43 | } else {
|
|---|
| 44 | expires_time = r->headers_out.last_modified_time + conf->expires_time;
|
|---|
| 45 | max_age = expires_time - now;
|
|---|