# HG changeset patch # User Maxim Dounin # Date 1369420089 -14400 # Node ID 2139768ee404a2e8b1e6164dbae0dc911fe14f1f # Parent 4c1a604b02851b7e28abe1b1ea2adedb18f5e59b Xslt: xslt_last_modified directive. Directive is similar to ssi_last_modified and sub_filter_last_modified directives introduced by previous commits. diff --git a/src/http/modules/ngx_http_xslt_filter_module.c b/src/http/modules/ngx_http_xslt_filter_module.c --- a/src/http/modules/ngx_http_xslt_filter_module.c +++ b/src/http/modules/ngx_http_xslt_filter_module.c @@ -58,6 +58,7 @@ typedef struct { ngx_hash_t types; ngx_array_t *types_keys; ngx_array_t *params; /* ngx_http_xslt_param_t */ + ngx_flag_t last_modified; } ngx_http_xslt_filter_loc_conf_t; @@ -150,6 +151,13 @@ static ngx_command_t ngx_http_xslt_filt offsetof(ngx_http_xslt_filter_loc_conf_t, types_keys), &ngx_http_xslt_default_types[0] }, + { ngx_string("xslt_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_xslt_filter_loc_conf_t, last_modified), + NULL }, + ngx_null_command }; @@ -300,9 +308,10 @@ static ngx_int_t ngx_http_xslt_send(ngx_http_request_t *r, ngx_http_xslt_filter_ctx_t *ctx, ngx_buf_t *b) { - ngx_int_t rc; - ngx_chain_t out; - ngx_pool_cleanup_t *cln; + ngx_int_t rc; + ngx_chain_t out; + ngx_pool_cleanup_t *cln; + ngx_http_xslt_filter_loc_conf_t *conf; ctx->done = 1; @@ -327,8 +336,13 @@ ngx_http_xslt_send(ngx_http_request_t *r r->headers_out.content_length = NULL; } - ngx_http_clear_last_modified(r); ngx_http_clear_etag(r); + + conf = ngx_http_get_module_loc_conf(r, ngx_http_xslt_filter_module); + + if (!conf->last_modified) { + ngx_http_clear_last_modified(r); + } } rc = ngx_http_next_header_filter(r); @@ -1058,6 +1072,8 @@ ngx_http_xslt_filter_create_conf(ngx_con * conf->params = NULL; */ + conf->last_modified = NGX_CONF_UNSET; + return conf; } @@ -1088,6 +1104,8 @@ ngx_http_xslt_filter_merge_conf(ngx_conf return NGX_CONF_ERROR; } + ngx_conf_merge_value(conf->last_modified, prev->last_modified, 0); + return NGX_CONF_OK; }