aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2013-05-24 22:27:30 +0400
committerMaxim Dounin <mdounin@mdounin.ru>2013-05-24 22:27:30 +0400
commitaf7e2a918502fd0e36e89458055f85dcc651e0db (patch)
tree46d1e0ad9a4e1e209ac028e41214cf5af5a97468 /src
parent55fcadcfa2d81536e63495b41c615664eb70349b (diff)
downloadnginx-af7e2a918502fd0e36e89458055f85dcc651e0db.tar.gz
nginx-af7e2a918502fd0e36e89458055f85dcc651e0db.zip
Sub filter: sub_filter_last_modified directive.
Directive is similar to ssi_last_modified introduced by previous commit. Patch by Alexey Kolpakov.
Diffstat (limited to 'src')
-rw-r--r--src/http/modules/ngx_http_sub_filter_module.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/http/modules/ngx_http_sub_filter_module.c b/src/http/modules/ngx_http_sub_filter_module.c
index 6ba57dfff..e0b2c5b67 100644
--- a/src/http/modules/ngx_http_sub_filter_module.c
+++ b/src/http/modules/ngx_http_sub_filter_module.c
@@ -17,6 +17,7 @@ typedef struct {
ngx_hash_t types;
ngx_flag_t once;
+ ngx_flag_t last_modified;
ngx_array_t *types_keys;
} ngx_http_sub_loc_conf_t;
@@ -89,6 +90,13 @@ static ngx_command_t ngx_http_sub_filter_commands[] = {
offsetof(ngx_http_sub_loc_conf_t, once),
NULL },
+ { ngx_string("sub_filter_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_sub_loc_conf_t, last_modified),
+ NULL },
+
ngx_null_command
};
@@ -167,8 +175,11 @@ ngx_http_sub_header_filter(ngx_http_request_t *r)
if (r == r->main) {
ngx_http_clear_content_length(r);
- ngx_http_clear_last_modified(r);
ngx_http_clear_etag(r);
+
+ if (!slcf->last_modified) {
+ ngx_http_clear_last_modified(r);
+ }
}
return ngx_http_next_header_filter(r);
@@ -674,6 +685,7 @@ ngx_http_sub_create_conf(ngx_conf_t *cf)
*/
slcf->once = NGX_CONF_UNSET;
+ slcf->last_modified = NGX_CONF_UNSET;
return slcf;
}
@@ -687,6 +699,7 @@ ngx_http_sub_merge_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_conf_merge_value(conf->once, prev->once, 1);
ngx_conf_merge_str_value(conf->match, prev->match, "");
+ ngx_conf_merge_value(conf->last_modified, prev->last_modified, 0);
if (conf->value.value.data == NULL) {
conf->value = prev->value;