[nginx] Xslt: xslt_last_modified directive.
Maxim Dounin
mdounin at mdounin.ru
Fri May 24 18:32:42 UTC 2013
details: http://hg.nginx.org/nginx/rev/2139768ee404
branches:
changeset: 5230:2139768ee404
user: Maxim Dounin <mdounin at mdounin.ru>
date: Fri May 24 22:28:09 2013 +0400
description:
Xslt: xslt_last_modified directive.
Directive is similar to ssi_last_modified and sub_filter_last_modified
directives introduced by previous commits.
diffstat:
src/http/modules/ngx_http_xslt_filter_module.c | 26 ++++++++++++++++++++++----
1 files changed, 22 insertions(+), 4 deletions(-)
diffs (72 lines):
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;
}
More information about the nginx-devel
mailing list