[nginx] SSI: ssi_last_modified directive.
Maxim Dounin
mdounin at mdounin.ru
Fri May 24 18:32:42 UTC 2013
details: http://hg.nginx.org/nginx/rev/cbd4bbe976d4
branches:
changeset: 5228:cbd4bbe976d4
user: Maxim Dounin <mdounin at mdounin.ru>
date: Fri May 24 22:27:23 2013 +0400
description:
SSI: ssi_last_modified directive.
The "ssi_last_modified" directive allows to preserve Last-Modified header
in SSI responses. The directive is similar to SSILastModified one available
in Apache:
http://httpd.apache.org/docs/2.4/mod/mod_include.html#ssilastmodified
Patch by Alexey Kolpakov.
diffstat:
src/http/modules/ngx_http_ssi_filter_module.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diffs (55 lines):
diff --git a/src/http/modules/ngx_http_ssi_filter_module.c b/src/http/modules/ngx_http_ssi_filter_module.c
--- a/src/http/modules/ngx_http_ssi_filter_module.c
+++ b/src/http/modules/ngx_http_ssi_filter_module.c
@@ -21,6 +21,7 @@ typedef struct {
ngx_flag_t enable;
ngx_flag_t silent_errors;
ngx_flag_t ignore_recycled_buffers;
+ ngx_flag_t last_modified;
ngx_hash_t types;
@@ -162,6 +163,13 @@ static ngx_command_t ngx_http_ssi_filte
offsetof(ngx_http_ssi_loc_conf_t, types_keys),
&ngx_http_html_default_types[0] },
+ { ngx_string("ssi_last_modified"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
+ ngx_conf_set_flag_slot,
+ NGX_HTTP_LOC_CONF_OFFSET,
+ offsetof(ngx_http_ssi_loc_conf_t, last_modified),
+ NULL },
+
ngx_null_command
};
@@ -359,9 +367,12 @@ ngx_http_ssi_header_filter(ngx_http_requ
if (r == r->main) {
ngx_http_clear_content_length(r);
- ngx_http_clear_last_modified(r);
ngx_http_clear_accept_ranges(r);
ngx_http_clear_etag(r);
+
+ if (!slcf->last_modified) {
+ ngx_http_clear_last_modified(r);
+ }
}
return ngx_http_next_header_filter(r);
@@ -2878,6 +2889,7 @@ ngx_http_ssi_create_loc_conf(ngx_conf_t
slcf->enable = NGX_CONF_UNSET;
slcf->silent_errors = NGX_CONF_UNSET;
slcf->ignore_recycled_buffers = NGX_CONF_UNSET;
+ slcf->last_modified = NGX_CONF_UNSET;
slcf->min_file_chunk = NGX_CONF_UNSET_SIZE;
slcf->value_len = NGX_CONF_UNSET_SIZE;
@@ -2896,6 +2908,7 @@ ngx_http_ssi_merge_loc_conf(ngx_conf_t *
ngx_conf_merge_value(conf->silent_errors, prev->silent_errors, 0);
ngx_conf_merge_value(conf->ignore_recycled_buffers,
prev->ignore_recycled_buffers, 0);
+ ngx_conf_merge_value(conf->last_modified, prev->last_modified, 0);
ngx_conf_merge_size_value(conf->min_file_chunk, prev->min_file_chunk, 1024);
ngx_conf_merge_size_value(conf->value_len, prev->value_len, 255);
More information about the nginx-devel
mailing list